)]}'
{
  "commit": "48513e05e2f226c85a9b88893630c8ae28409772",
  "tree": "9113174facd05c42c0f286a7cf93781294ae6bd4",
  "parents": [
    "94f057755b7941b321fd11fec1b2e3ca5313a4e0"
  ],
  "author": {
    "name": "Adam Johnson",
    "email": "me@adamj.eu",
    "time": "Fri May 22 23:12:25 2026 +0000"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Sun May 24 18:43:22 2026 +0900"
  },
  "message": "stash: reuse cached index entries in --patch temporary index\n\n`git stash -p` prepares the interactive selection by creating a\ntemporary index at HEAD, switching `GIT_INDEX_FILE` to it, and then\nrunning the `add -p` machinery.\n\nThat temporary index was created by running `git read-tree HEAD`.  The\nresulting index had no useful cached stat data or fsmonitor-valid bits\nfrom the real index.  When `run_add_p()` refreshed that temporary index\nbefore showing the first prompt, it could end up lstat(2)-ing every\ntracked file, even in a repository where `git diff` and `git restore -p`\ncan use fsmonitor to avoid that work.\n\nCreate the temporary index in-process instead.  Use `unpack_trees()` to\nreset the real index contents to HEAD while writing the result to the\ntemporary index path.  For paths whose index entries already match HEAD,\n`oneway_merge()` reuses the existing cache entries, preserving their\ncached stat data and `CE_FSMONITOR_VALID` state.\n\nThis makes the refresh performed by `run_add_p()` behave like the one\nused by `git restore -p`: unchanged paths can be skipped via fsmonitor\ninstead of being scanned again.\n\nIn a 206k file repository with `core.fsmonitor` enabled and a one-line\nchange in one file, time to first prompt dropped from 34.774 seconds to\n0.659 seconds. The new perf test file demonstrates similar improvements,\nwith maen times for without- and with-fsmonitor cases dropping from 6.90\nand 6.83 seconds to 0.55 and 0.28 seconds, respectively.\n\nSigned-off-by: Adam Johnson \u003cme@adamj.eu\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0d27b2fb1fcb67e0bde913d61e9adaf6c9a075fd",
      "old_mode": 33188,
      "old_path": "builtin/stash.c",
      "new_id": "640be770c5d02af704a04b4fdc423e05b310ec0a",
      "new_mode": 33188,
      "new_path": "builtin/stash.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4cfce638bed6f4db0d8224daca633ba3e068edd6",
      "new_mode": 33261,
      "new_path": "t/perf/p3904-stash-patch.sh"
    }
  ]
}
