UPSTREAM PR #2503: feat: use the IOUC (UNTR extension) to speed up directory walks#39
Open
UPSTREAM PR #2503: feat: use the IOUC (UNTR extension) to speed up directory walks#39
Conversation
When `core.untrackedCache` is true, `gix-dir` now consults the index `UNTR` extension before opening each directory. Directories whose stat and exclude-file OID still match the cache are served from memory, avoiding `read_dir` syscalls for unchanged trees. As part of verifying the change, I discovered ctime/mtime decoding was incorrect. The stat decoder assigned `ctime_secs/nsecs` to the `mtime` field and vice versa. The binary format stores ctime first then mtime; correcting the swap fixes IOUC stat comparisons for directories where ctime ≠ mtime. Co-authored-by: GPT 5.4 <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
… mismatch The test used `gix::open::Options::isolated()` (no global config) but ran `git status` without isolation, so users with `core.excludesFile` in `~/.gitconfig` would have that file's stat baked into the UNTR cache. gix (isolated) wouldn't know about the file, causing cache validation to fail and `read_dir_calls` to be nonzero. Fix by writing an empty `global-excludes` file and setting `core.excludesFile` in the local repo config before running `git update-index` and `git status`, so both git and gix agree on which excludes file was used when the cache was written. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Git's core.untrackedCache is tri-state (keep|true|false); "keep" is the documented default and means "preserve the existing cache state". The previous code parsed the value as a boolean, so "keep" produced a config parse error and made dirwalk_options() fail on any repo with that setting. Treat keep the same as the absent case: don't activate the untracked cache from config alone, while still allowing callers to opt in via UntrackedCache::Use. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
cdbe120 to
78a7ab5
Compare
49231d8 to
bc0a777
Compare
|
The analysis encountered an error. Please review the Processing Details for more information. |
1 similar comment
|
The analysis encountered an error. Please review the Processing Details for more information. |
c6739bc to
6f67b12
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Source pull request: GitoxideLabs/gitoxide#2503
When
core.untrackedCacheis true,gix-dirnow consults the indexUNTRextension before opening each directory. Directories whose stat and exclude-file OID still match the cache are served from memory, avoidingread_dirsyscalls for unchanged trees.As part of verifying the change, I discovered ctime/mtime decoding was incorrect. The stat decoder assigned
ctime_secs/nsecsto themtimefield and vice versa. The binary format stores ctime first then mtime; correcting the swap fixes IOUC stat comparisons for directories where ctime ≠ mtime.Per CONTRIBUTING.md, disclosing (heavy) AI use in these changes (and have done so in the commit trailers). I went through a number of iterations and have manually tested that things "seem to work on my machine" (installing gix locally and using gix status / playing around with --statistics and adding untracked files and making sure they reflect with minimal directory crawling), but acknowledging I have large gaps in my understanding of this codebase and also git's.
Thanks in advance if you spend the time to review this. I'm very happy to take feedback and fix things up.