)]}'
{
  "commit": "bc67b4ab5f8bc268ecd2d9bb7dc1b7bf26884a8e",
  "tree": "16524e1388f4d785ba359eb507b7755d3d114c3b",
  "parents": [
    "8ddcdc1bb33ccf803461dd2365146f9341bf9312"
  ],
  "author": {
    "name": "Karthik Nayak",
    "email": "karthik.188@gmail.com",
    "time": "Wed Jan 15 11:54:51 2025 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Wed Jan 15 09:12:09 2025 -0800"
  },
  "message": "reftable: write correct max_update_index to header\n\nIn 297c09eabb (refs: allow multiple reflog entries for the same refname,\n2024-12-16), the reftable backend learned to handle multiple reflog\nentries within the same transaction. This was done modifying the\n`update_index` for reflogs with multiple indices. During writing the\nlogs, the `max_update_index` of the writer was modified to ensure the\nlimits were raised to the modified `update_index`s.\n\nHowever, since ref entries are written before the modification to the\n`max_update_index`, if there are multiple blocks to be written, the\nreftable backend writes the header with the old `max_update_index`. When\nall logs are finally written, the footer will be written with the new\n`min_update_index`. This causes a mismatch between the header and the\nfooter and causes the reftable file to be corrupted. The existing tests\nonly spawn a single block and since headers are lazily written with the\nfirst block, the tests didn\u0027t capture this bug.\n\nTo fix the issue, the appropriate `max_update_index` limit must be set\neven before the first block is written. Add a `max_index` field to the\ntransaction which holds the `max_index` within all its updates, then\npropagate this value to the reftable backend, wherein this is used to\nthe set the `max_update_index` correctly.\n\nAdd a test which creates a few thousand reference updates with multiple\nreflog entries, which should trigger the bug.\n\nReported-by: brian m. carlson \u003csandals@crustytoothpaste.net\u003e\nSigned-off-by: Karthik Nayak \u003ckarthik.188@gmail.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c55583986940d8ef1e1c839364c03cd92d4f7114",
      "old_mode": 33188,
      "old_path": "refs.c",
      "new_id": "a5851a7de00878cc5b647c38b14c94dbf9edcb09",
      "new_mode": 33188,
      "new_path": "refs.c"
    },
    {
      "type": "modify",
      "old_id": "79b287c5ec5c7d8f759869cf93cda405640186dc",
      "old_mode": 33188,
      "old_path": "refs/refs-internal.h",
      "new_id": "2aaff91ab4826adea7d51295eca9d3507700b71e",
      "new_mode": 33188,
      "new_path": "refs/refs-internal.h"
    },
    {
      "type": "modify",
      "old_id": "bec5962debea7b62572d08f6fa8fd38ab4cd8af6",
      "old_mode": 33188,
      "old_path": "refs/reftable-backend.c",
      "new_id": "68db2baa8f15c44453656661f5295dbc0596b563",
      "new_mode": 33188,
      "new_path": "refs/reftable-backend.c"
    },
    {
      "type": "modify",
      "old_id": "f59bc4860f19c4af82dc6f2984bdb69d61fe3ec2",
      "old_mode": 33261,
      "old_path": "t/t1460-refs-migrate.sh",
      "new_id": "307b2998efe6ac05e2e3c3342e6b568c3b30a129",
      "new_mode": 33261,
      "new_path": "t/t1460-refs-migrate.sh"
    }
  ]
}
