Skip to content

UPSTREAM PR #2503: feat: use the IOUC (UNTR extension) to speed up directory walks#39

Open
loci-dev wants to merge 9 commits intomainfrom
loci/pr-2503-use-untracked-cache
Open

UPSTREAM PR #2503: feat: use the IOUC (UNTR extension) to speed up directory walks#39
loci-dev wants to merge 9 commits intomainfrom
loci/pr-2503-use-untracked-cache

Conversation

@loci-dev
Copy link
Copy Markdown

@loci-dev loci-dev commented Apr 5, 2026

Note

Source pull request: GitoxideLabs/gitoxide#2503

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.


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.

AaronMoat and others added 7 commits April 5, 2026 09:41
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]>
… 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]>
@loci-dev loci-dev force-pushed the main branch 3 times, most recently from cdbe120 to 78a7ab5 Compare April 11, 2026 07:49
@loci-dev loci-dev force-pushed the main branch 6 times, most recently from 49231d8 to bc0a777 Compare April 20, 2026 07:18
@loci-review
Copy link
Copy Markdown

loci-review Bot commented Apr 22, 2026

The analysis encountered an error. Please review the Processing Details for more information.

1 similar comment
@loci-review
Copy link
Copy Markdown

loci-review Bot commented Apr 22, 2026

The analysis encountered an error. Please review the Processing Details for more information.

@loci-dev loci-dev force-pushed the main branch 4 times, most recently from c6739bc to 6f67b12 Compare April 29, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants