)]}'
{
  "commit": "3f5203eeb46e6e01c7848acde4bf5a62d0dd7d1b",
  "tree": "7ff1a137768db629b06c751de0f7edc55b4668d1",
  "parents": [
    "ea97ad8d017de0c9037451a78008a0fd60abea0c"
  ],
  "author": {
    "name": "Tamir Duberstein",
    "email": "tamird@gmail.com",
    "time": "Thu Jun 11 21:31:51 2026 -0700"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Fri Jun 12 12:47:21 2026 -0700"
  },
  "message": "ls-files: filter pathspec before lstat\n\nIn --deleted and --modified modes, show_files() calls lstat() for each\nindex entry before show_ce() applies the pathspec. prune_index() avoids\nmost of these calls for pathspecs with a common directory prefix, but\nnot for a top-level name or leading wildcard.\n\nMatch before lstat() to avoid accessing the worktree for entries that\ncannot be shown. Treat this as a prefilter: do not update ps_matched,\nand retain the match in show_ce() so --error-unmatch is satisfied only\nby entries that the selected modes actually show.\n\nPrefilter only a single pathspec item, bounding the added work for each\nindex entry. Applying match_pathspec() to multiple arguments can cost\nmore than the lstat() calls it avoids. In a synthetic repository with\n10,000 clean files, passing every path to ls-files --modified increased\nruntime from 112.5 ms to 494.1 ms when the prefilter was unconditional.\n\nWith $parent and $this exported as paths to binaries built from the\nparent and this commit, on a repository with 881,290 index entries:\n\n    hyperfine --warmup 0 --runs 3 \\\n        --command-name parent \\\n        \u0027$parent -c core.fsmonitor\u003dfalse ls-files --deleted -- README.md \u003e/dev/null\u0027 \\\n        --command-name this-commit \\\n        \u0027$this -c core.fsmonitor\u003dfalse ls-files --deleted -- README.md \u003e/dev/null\u0027\n\nreported means of 65.790 seconds for the parent and 4.987 seconds for\nthis commit.\n\nLink: https://lore.kernel.org/r/xmqqfr2tnfk0.fsf@gitster.g\nHelped-by: Jeff King \u003cpeff@peff.net\u003e\nSigned-off-by: Tamir Duberstein \u003ctamird@gmail.com\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "12d5d828ff581aeaf43124e618ac3ce25203ee8e",
      "old_mode": 33188,
      "old_path": "builtin/ls-files.c",
      "new_id": "99e98fc187accb2d42cc9a35343f6d2aaab7563b",
      "new_mode": 33188,
      "new_path": "builtin/ls-files.c"
    },
    {
      "type": "modify",
      "old_id": "c5832fee05356133b7e58c792e4cc0a8756fe5c9",
      "old_mode": 33188,
      "old_path": "t/meson.build",
      "new_id": "3219264fe7d4973ff96436b5c5ea2f6a9b9468a1",
      "new_mode": 33188,
      "new_path": "t/meson.build"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ae14449432453b5693e8735ef8059e003ed06292",
      "new_mode": 33261,
      "new_path": "t/perf/p3010-ls-files.sh"
    },
    {
      "type": "modify",
      "old_id": "7af4532cd1dfd063f554f3b049052d27006db483",
      "old_mode": 33261,
      "old_path": "t/t3010-ls-files-killed-modified.sh",
      "new_id": "6e38e10219e28e689be00298feb953787584352e",
      "new_mode": 33261,
      "new_path": "t/t3010-ls-files-killed-modified.sh"
    }
  ]
}
