)]}'
{
  "commit": "b32c7ec02f6407bf3445b0fedf6c7294179b7e49",
  "tree": "d9db5ebce3b5aaa7d5629c9e945cd19e19d16140",
  "parents": [
    "1129596dc88a5b0ad53e0d36981bd91c2352cba8"
  ],
  "author": {
    "name": "Jeff King",
    "email": "peff@peff.net",
    "time": "Mon Jun 23 06:56:25 2025 -0400"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Tue Jun 24 06:34:25 2025 -0700"
  },
  "message": "test-lib: teach test_seq the -f option\n\nThe \"seq\" tool has a \"-f\" option to produce printf-style formatted\nlines. Let\u0027s teach our test_seq helper the same trick. This lets us get\nrid of some shell loops in test snippets (which are particularly verbose\nin our test suite because we have to \"|| return 1\" to keep the \u0026\u0026-chain\ngoing).\n\nThis converts a few call-sites I found by grepping around the test\nsuite. A few notes on these:\n\n  - In \"seq\", the format specifier is a \"%g\" float. Since test_seq only\n    supports integers, I\u0027ve kept the more natural \"%d\" (which is what\n    these call sites were using already).\n\n  - Like \"seq\", test_seq automatically adds a newline to the specified\n    format. This is what all callers are doing already except for t0021,\n    but there we do not care about the exact format. We are just trying\n    to printf a large number of bytes to a file. It\u0027s not worth\n    complicating other callers or adding an option to avoid the newline\n    in that caller.\n\n  - Most conversions are just replacing a shell loop (which does get rid\n    of an extra fork, since $() requires a subshell). In t0612 we can\n    replace an awk invocation, which I think makes the end result more\n    readable, as there\u0027s less quoting.\n\n  - In t7422 we can replace one loop, but sadly we have to leave the\n    loop directly above it. This is because that earlier loop wants to\n    include the seq value twice in the output, which test_seq does not\n    support (nor does regular seq). If you run:\n\n      test_seq -f \"foo-%d %d\" 10\n\n    the second \"%d\" will always be the empty string. You might naively\n    think that test_seq could add some extra arguments, like:\n\n      # 3 ought to be enough for anyone...\n      printf \"$fmt\\n\" \"$i \"$i\" $i\"\n\n    but that just triggers printf to format multiple lines, one per\n    extra set of arguments.\n\n    So we\u0027d have to actually parse the format string, figure out how\n    many \"%\" placeholders are there, and then feed it that many\n    instances of the sequence number. The complexity isn\u0027t worth it.\n\nSigned-off-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "bf10d253ec40991a077ae985857781542b14aec8",
      "old_mode": 33261,
      "old_path": "t/t0021-conversion.sh",
      "new_id": "f0d50d769e9fc56f6147e9cc5421ba7408eb2fe6",
      "new_mode": 33261,
      "new_path": "t/t0021-conversion.sh"
    },
    {
      "type": "modify",
      "old_id": "1be534a89533d00ff2d4cf29ecb7bce437a361f5",
      "old_mode": 33261,
      "old_path": "t/t0610-reftable-basics.sh",
      "new_id": "3ea5d51532a8b88ac8e36d79613812ed4668234a",
      "new_mode": 33261,
      "new_path": "t/t0610-reftable-basics.sh"
    },
    {
      "type": "modify",
      "old_id": "d0d7e80b492091d1949467f9835c35f622ae0bb4",
      "old_mode": 33261,
      "old_path": "t/t0612-reftable-jgit-compatibility.sh",
      "new_id": "7df2ad5817e745c8caaaa5c05cfbf6137216c935",
      "new_mode": 33261,
      "new_path": "t/t0612-reftable-jgit-compatibility.sh"
    },
    {
      "type": "modify",
      "old_id": "6447920c9be4c0d9805ee27cd4d6ce63ce59167b",
      "old_mode": 33261,
      "old_path": "t/t0613-reftable-write-options.sh",
      "new_id": "d77e601111f6cd5c2eaf5ccd4abeb211dc606ef0",
      "new_mode": 33261,
      "new_path": "t/t0613-reftable-write-options.sh"
    },
    {
      "type": "modify",
      "old_id": "d29d23cb8905f865e68da0e782c3cbe1948c6c3f",
      "old_mode": 33261,
      "old_path": "t/t1400-update-ref.sh",
      "new_id": "e373d9108b651a0c7622a58aab515f212a06043b",
      "new_mode": 33261,
      "new_path": "t/t1400-update-ref.sh"
    },
    {
      "type": "modify",
      "old_id": "51749951916008f8516b62fffb24437d47057025",
      "old_mode": 33261,
      "old_path": "t/t5004-archive-corner-cases.sh",
      "new_id": "027dedd9760a1812664cb725251523185696bd6e",
      "new_mode": 33261,
      "new_path": "t/t5004-archive-corner-cases.sh"
    },
    {
      "type": "modify",
      "old_id": "9cbe7ca78245d99a69e86723af4182db18e6db45",
      "old_mode": 33261,
      "old_path": "t/t6422-merge-rename-corner-cases.sh",
      "new_id": "f14c0fb30e1bf293a7870c0210e66189bb20877e",
      "new_mode": 33261,
      "new_path": "t/t6422-merge-rename-corner-cases.sh"
    },
    {
      "type": "modify",
      "old_id": "ea67057f1a41d9b290280480c1b19c924d6dea7b",
      "old_mode": 33261,
      "old_path": "t/t7422-submodule-output.sh",
      "new_id": "aea1ddf117e8ee6c73809b67306647acab057818",
      "new_mode": 33261,
      "new_path": "t/t7422-submodule-output.sh"
    },
    {
      "type": "modify",
      "old_id": "bee4a2ca3472e1b79e2a7bba5abdaa81235704c7",
      "old_mode": 33188,
      "old_path": "t/test-lib-functions.sh",
      "new_id": "6230746cc4d31f33a911393a76e2cd05f8085dfc",
      "new_mode": 33188,
      "new_path": "t/test-lib-functions.sh"
    }
  ]
}
