)]}'
{
  "commit": "0d0e4b5954e97fcdfd0a4120e17e2c570497981a",
  "tree": "387d04f43ff2522d03248f58e20c63c864a7fff4",
  "parents": [
    "02a7f6ffab9ec7641f88032f30998976bca07820"
  ],
  "author": {
    "name": "Patrick Steinhardt",
    "email": "ps@pks.im",
    "time": "Thu Oct 30 11:38:42 2025 +0100"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Thu Oct 30 07:09:53 2025 -0700"
  },
  "message": "builtin/pack-objects: simplify logic to find kept or nonlocal objects\n\nThe function `has_sha1_pack_kept_or_nonlocal()` takes an object ID and\nthen searches through packed objects to figure out whether the object\nexists in a kept or non-local pack. As a performance optimization we\nremember the packfile that contains a given object ID so that the next\ncall to the function first checks that same packfile again.\n\nThe way this is written is rather hard to follow though, as the caching\nmechanism is intertwined with the loop that iterates through the packs.\nConsequently, we need to do some gymnastics to re-start the iteration if\nthe cached pack does not contain the objects.\n\nRefactor this so that we check the cached packfile at the beginning. We\ndon\u0027t have to re-verify whether the packfile meets the properties as we\nhave already verified those when storing the pack in `last_found` in the\nfirst place. So all we need to do is to use `find_pack_entry_one()` to\ncheck whether the pack contains the object ID, and to skip the cached\npack in the loop so that we don\u0027t search it twice.\n\nFurthermore, stop using the `(void *)1` sentinel value and instead use a\nsimple `NULL` pointer to indicate that we don\u0027t have a last-found pack\nyet.\n\nThis refactoring significantly simplifies the logic and makes it much\neasier to follow.\n\nSigned-off-by: Patrick Steinhardt \u003cps@pks.im\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "5348aebbe9f190a6bdf685cb500dda746ce24301",
      "old_mode": 33188,
      "old_path": "builtin/pack-objects.c",
      "new_id": "b83eb8ead14139516a183fc0503189aa3a6c90be",
      "new_mode": 33188,
      "new_path": "builtin/pack-objects.c"
    }
  ]
}
