Add -g / --gitignore: respect per-directory .gitignore (ignore family, PR 4/4) - #201
Merged
Conversation
…, PR 4/4) Completes the core ignore family: -g / --gitignore makes xff respect a .gitignore in every directory, reusing the #199 per-directory stack (deeper overrides shallower). Off by default (find-compatible); --gitignore=off turns it back off, and -u / --no-ignore remains the master switch over every source. - run.cc: GitignoreEnabled(globals) (last occurrence wins, =off disables); ResolveIgnoreFileNames now builds the per-directory filename list from all sources, lowest precedence first: .gitignore (-g) < .ignore < .xffignore (--ignore-files), so within a directory the xff-specific file wins. -u/--no-ignore returns none. Self-documentation (same change): --gitignore (alias -g) GlobalFlag in the Ignore / filter group (flow into --help / --man / --markdown) + the kHelpText usage page. cli/ignore_gitignore_test.sh: off by default, -g respects recursively, =off and -u/--no-ignore disable, a nested .gitignore scopes to its subtree, --help topic. Scope note: bare -g means ON today. The design's bare-g=auto (respect iff in a git repo), .git/info/exclude, global core.excludesFile, and the -g+/-g- suffix-sign spelling need git-repo detection + toggle-parser machinery not built yet; tracked as a follow-up (#95). bazel test //... green (33 tests).
helly25
enabled auto-merge (squash)
July 1, 2026 23:39
…c failure The --help=-g assertion flaked once on the ubuntu clang-asan CI cell (intermittent, not reproducible on macOS-asan / ubuntu-default / locally) as a bare 'substring missing', hiding the xff subprocess's captured stderr. Assert the exit status and print the captured output on mismatch so a recurrence shows the real cause (e.g. a sanitizer abort) rather than masquerading. Diagnostic + stricter; no behavior change.
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.
PR 4 of 4 - completes the core ignore family (task #80).
-g/--gitignoremakes xff respect a.gitignorein every directory, reusing the #199 per-directory stack (deeper overrides shallower). Off by default (find-compatible);--gitignore=offdisables, and-u/--no-ignorestays the master switch over every source.GitignoreEnabled(last occurrence wins,=offdisables);ResolveIgnoreFileNamesnow composes the per-directory filename list from all sources, lowest precedence first:.gitignore(-g) <.ignore<.xffignore(--ignore-files), so within a directory the xff-specific file wins.-u/--no-ignore-> none.--gitignore(alias-g) in the Ignore / filter group (->--help/--man/--markdown) +kHelpText.Tests:
cli/ignore_gitignore_test.sh- off by default,-grespects recursively,=offand-udisable, a nested.gitignorescopes to its subtree,--help=-gtopic.bazel test //...green (33 tests).Scope note: bare
-gmeans on today. The design's bare-g=auto (respect iff in a git repo),.git/info/exclude, globalcore.excludesFile, and the-g+/-g-suffix-sign spelling need git-repo detection + toggle-parser machinery not built yet - tracked as a follow-up (task #95).With this the ignore family core is complete:
--exclude/--include,--ignore-files(.ignore/.xffignore),-g(.gitignore), and-u/--no-ignore, all on one per-directory matcher.