Commit 66f8bc3
Match git check-ignore for tracked ignored paths
Fix gix exclude query so ignore matches are suppressed for paths that are present in the index, matching git check-ignore behavior for tracked files under ignored directories.
The issue reproduces with a root ignore rule like bin/ and a force-added tracked file such as src/bin/stub_gen.rs. Git reports no ignore pattern for src/bin, src/bin/, or src/bin/stub_gen.rs, but still reports the bin/ rule for untracked paths like src/bin/extra.txt and other/bin/file.txt. gix status already matched this behavior through the dirwalk, so the fix is in the exclude query command path.
The query implementation now checks the index before printing exclude matches, preserves stdin paths relative to the caller current directory, and keeps pathspec expansion semantics for tracked entries, exclusions, top magic, and attribute-qualified pathspecs.
Tests cover both gix exclude query input modes against git check-ignore -vn --stdin, subdirectory stdin handling, pathspec expansion behavior, and the gix-worktree ignore baseline case for tracked files under ignored directories.
Validation:
- cargo test -p gitoxide-core --lib --quiet
- GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix-worktree-tests worktree::stack::ignore --quiet
Fixes #25621 parent 3af9b4a commit 66f8bc3
3 files changed
Lines changed: 546 additions & 43 deletions
File tree
- gitoxide-core/src/repository
- gix-worktree/tests
- fixtures
- worktree/stack
0 commit comments