fix(discover): honor an enclosing repo's .gitignore for a git-less subfolder - #2181
Open
AmirF194 wants to merge 1 commit into
Open
fix(discover): honor an enclosing repo's .gitignore for a git-less subfolder#2181AmirF194 wants to merge 1 commit into
AmirF194 wants to merge 1 commit into
Conversation
…bfolder resolve_git_common_dir() only stats repo_path/.git directly, so indexing a subfolder with no .git of its own never consulted any ancestor repo's .gitignore. Add resolve_enclosing_git_root() to walk up parent directories the way git itself does, and merge that ancestor's .gitignore (and info/exclude) ahead of the subfolder's own so the more specific file still wins on conflict. Fixes DeusData#510 Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
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.
discover_implonly ever loaded.gitignorefromrepo_pathitself (fixed for the first half of #510 by 3f754cf) and, whenrepo_pathcarries its own.git, from that repo'sinfo/exclude. Whenrepo_pathis a subfolder with no.gitof its own, the enclosing repository's root.gitignorewas never consulted, so files the enclosing repo ignores (secrets, build output) get indexed and become searchable.Added
resolve_enclosing_git_root(): whenresolve_git_common_dir(repo_path, ...)fails, walk up parent directories the same waygitdoes from a subfolder, and load the first ancestor's.gitignore(plus itsinfo/exclude, sinceis_git_repobecomes true once an ancestor is found). It's merged ahead ofrepo_path's own.gitignoreso the more specific file still wins on conflict viacbm_gitignore_merge, matching git's shallow-to-deep precedence.Added three tests: enclosing root
.gitignorehonored, enclosinginfo/excludehonored, and the indexed subfolder's own.gitignorestill overriding the enclosing one on conflict. All three go red without the fix. Ranscripts/test.sh(every suite, ASan+UBSan) on this branch and it's fully green.clang-formatis clean on both files;cppcheck/clang-tidyflag a couple of pre-existing things incompat_regex.c/cli.c/mcp.cthat this diff doesn't touch, same result on plain main.Fixes #510