Don’t look at ignore files outside initialized repos#15941
Merged
RobinMalfait merged 8 commits intonextfrom Jan 28, 2025
Merged
Don’t look at ignore files outside initialized repos#15941RobinMalfait merged 8 commits intonextfrom
RobinMalfait merged 8 commits intonextfrom
Conversation
Member
RobinMalfait
left a comment
There was a problem hiding this comment.
Very nice! I wonder if we can add an integration test that mimics the behavior people were running into and that should now be fixed.
We should also run cargo fmt to format everything nicely.
a33156c to
c22a381
Compare
RobinMalfait
approved these changes
Jan 28, 2025
Member
RobinMalfait
left a comment
There was a problem hiding this comment.
Looks good, just need a changelog entry
193192b to
8e76995
Compare
RobinMalfait
approved these changes
Jan 28, 2025
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.
Right now, when Oxide is scanning for files, it considers ignore files in the "root" directory it is scanning as well as all parent directories.
We honor .gitignore files even when not in a git repo as an optimization in case a project has been created, contains a .gitignore, but no repo has actually been initialized. However, this has an unintended side effect of including ignore files ouside of a repo when there is one. This means that if you have a .gitignore file in your home folder it'll get applied even when you're inside a git repo which is not what you'd expect.
This PR addresses this by checking to see the folder being scanned is inside a repo and turns on a flag that ensures .gitignore files from the repo are the only ones used (global ignore files configured in git still work tho).
This still needs lots of tests to make sure things work as expected.
Fixes #15876