Skip to content

[pull] master from microsoft:master#80

Merged
pull[bot] merged 2 commits into
cgallred:masterfrom
microsoft:master
Apr 9, 2026
Merged

[pull] master from microsoft:master#80
pull[bot] merged 2 commits into
cgallred:masterfrom
microsoft:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 9, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

tyrielv added 2 commits April 9, 2026 14:13
Git fires the post-index-change hook for every index write, including
temp indexes created via GIT_INDEX_FILE redirect (e.g. read-tree
--index-output, git add with a temp index). The GVFS mount process
only needs to know about changes to the real `\$GIT_DIR/index`.

When writing a 194MB temp index (2.47M entries), the hook's pipe
round-trip to the GVFS mount process adds ~5s of overhead per
read-tree/add call — a significant regression for tools that
use the temp-index flow.

Add an early-exit check in IsNonCanonicalIndex() that resolves both
GIT_INDEX_FILE and `\$GIT_DIR/index` to absolute paths via
GetFullPathNameA, then compares case-insensitively. If they differ,
the hook exits immediately without contacting the mount process.

When the environment is unexpected (GIT_DIR absent, path resolution
fails), we err on the side of correctness and proceed with the
notification rather than silently suppressing it.

Unit tests invoke the hook exe with controlled environment variables
and WorkingDirectory set to %TEMP% (outside any GVFS mount) to
verify:
- temp index paths (should skip)
- canonical index paths (should NOT skip, exits NotInGVFSEnlistment)
- missing GIT_DIR (should NOT skip)
- mixed separators and case (normalization via GetFullPathNameA)

Note: the ideal long-term fix is in Git's do_write_locked_index()
(read-cache.c) to skip firing the hook entirely for non-default
indexes, avoiding the process spawn altogether.

Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
…temp-index

PostIndexChangedHook: skip notification for non-canonical indexes
@pull pull Bot locked and limited conversation to collaborators Apr 9, 2026
@pull pull Bot added the ⤵️ pull label Apr 9, 2026
@pull pull Bot merged commit 7352617 into cgallred:master Apr 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant