fix: don't let git ignore rules override tracked-file inclusion#110
Merged
Conversation
`generate`'s directory walk honored .gitignore (including a personal global core.excludesFile), .git/info/exclude, and local .gitignore in addition to the tool's own `tracked_files` (git ls-files) check. If a directory is force-tracked despite matching one of those rules, the walker pruned it entirely before the tracked-files check ever ran, silently dropping its ownership entries from CODEOWNERS -- and only on whatever machine's git config happens to match, since a personal global gitignore has nothing to do with what's committed to the project. Disable git_global/git_ignore/git_exclude on the WalkBuilder; inclusion is already handled precisely by tracked_files. `.ignore` files are left enabled since they're this tool's own opt-in exclusion mechanism, unrelated to git tracking status (see tests/fixtures/valid_project/.ignore).
dduugg
force-pushed
the
fix/global-gitignore-drops-tracked-entries
branch
from
July 21, 2026 18:18
50b0857 to
2ad7e7c
Compare
The audit job was failing to install cargo-audit: the archived actions-rs/audit-check@v1 has no toolchain pin, and the latest cargo-audit's dependency graph (kstring 2.0.4) now requires a newer rustc than this repo's pinned rust-toolchain.toml (1.89.0) provides. Switch to the actively maintained fork, rustsec/audit-check, and override RUSTUP_TOOLCHAIN to stable for just this job so `cargo install cargo-audit` isn't stuck on the pin used to build the actual crate. Also bump version to 0.3.4 for release.
dduugg
force-pushed
the
fix/global-gitignore-drops-tracked-entries
branch
from
July 21, 2026 18:23
2ad7e7c to
04a420d
Compare
dduugg
enabled auto-merge (squash)
July 21, 2026 18:26
cargo-audit flagged both as RUSTSEC advisories once the audit job could actually run (RUSTSEC-2026-0204: invalid pointer dereference in crossbeam-epoch <0.9.20; RUSTSEC-2025-0055: ANSI escape injection in tracing-subscriber <0.3.20).
perryqh
approved these changes
Jul 21, 2026
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.
What is this change doing?
git_global,git_ignore, andgit_excludeon theWalkBuilderused inproject_builder.rs, and adds a regression test.auditworkflow: replaces the archivedactions-rs/audit-check@v1with the maintained forkrustsec/audit-check@v2.0.0, and overridesRUSTUP_TOOLCHAINtostablefor that job only.crossbeam-epochandtracing-subscriberinCargo.lockto patched versions, per two real advisories the now-working audit job surfaced.0.3.4.Why is this change being made?
(1) Directory-walk fix:
generate's directory walk honors git's own ignore semantics (a personal globalcore.excludesFile, local.gitignore, and.git/info/exclude) in addition to the tool's owntracked_filescheck (git ls-files). If a directory is force-tracked despite matching one of those rules, the walker prunes it before the tracked-files check ever runs — silently dropping its ownership entries from the generated CODEOWNERS.This is nasty in practice because it's machine-dependent: whether a given repo's CODEOWNERS regenerates correctly depends on whether the developer running it happens to have a personal global gitignore rule that collides with something force-tracked in the project. I hit this directly: a personal
~/.gitignore_globalcontaining a blanket.claude/rule (unrelated to any specific project, just personal declutter preference) causedgenerateto silently drop 4 legitimate, git-tracked.claude/**ownership entries from a real CODEOWNERS file — on my machine only. CI (no such global config) generated the correct output, which made this very confusing to track down:validatefailures that only reproduced on one machine, with a completely clean/unmodified checkout..ignorefiles are left enabled — those are this tool's own opt-in exclusion mechanism (seetests/fixtures/valid_project/.ignore), which is unrelated to git tracking status and shouldn't be touched by this fix.(2) Audit workflow fix: the
auditjob was failing outright (see this run):Two compounding problems:
actions-rs/audit-check@v1's org is archived/unmaintained, so any upstream fix there is a dead end. Replaced with the actively maintained fork,rustsec/audit-check@v2.0.0— sametokeninput, drop-in swap.1.89.0in the error isn'tubuntu-latest's default Rust, it's this repo's ownrust-toolchain.tomlpin (used to build the actual crate), which rustup applies to everycargoinvocation from within the repo, including the audit action's internalcargo install cargo-audit. Latestcargo-audit's dependency tree now needs a newer rustc than that pin provides. Fixed by settingRUSTUP_TOOLCHAIN: stableas a job-level env var — it overrides the directory-level toolchain file for just this job, socargo-auditgets a current toolchain without touching the pin the rest of CI builds against.(3) Dependency advisories: once the audit job could actually run, it immediately found two real advisories already present on
main, unrelated to anything else in this PR:RUSTSEC-2026-0204—crossbeam-epochinvalid pointer dereference infmt::Pointer/fmt::Display, fixed in0.9.20(we were on0.9.14).RUSTSEC-2025-0055—tracing-subscriberANSI escape sequence injection in logs, fixed in0.3.20(we were on0.3.19).cargo update -p crossbeam-epoch -p tracing-subscriberpulled in the patched versions with no code changes needed. (Two additional "unsound" advisories onanyhow/error-stackare informational-only percargo-auditand don't fail the check; left alone.)(4) Version bump: for release, now that everything above is in.
How did you test this change?
tests/global_gitignore_test.rs, using a.git/info/excluderule as a reliable stand-in for the global-gitignore repro (avoids fighting$HOME/core.excludesFileresolution in a sandboxed test). Confirmed it fails without the fix and passes with it.cargo test— full suite (133+ tests) passes after every change in this PR, including the dependency bumps.cargo clippy --all-targets --all-features -- -D warningsandcargo fmt -- --check— clean (enforced by the repo's own pre-commit hook) after every commit.core.excludesFilebefore narrowing to the more portable.git/info/excluderepro used in the test.rust-toolchain.tomlpin as the real cause; adding theRUSTUP_TOOLCHAINoverride got the job actually running, which is what then surfaced the two real advisories fixed in (3).