Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t look at ignore files outside initialized repos #15941

Merged
merged 8 commits into from
Jan 28, 2025

Conversation

thecrypticace
Copy link
Contributor

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

@thecrypticace thecrypticace marked this pull request as ready for review January 27, 2025 20:37
@thecrypticace thecrypticace requested a review from a team as a code owner January 27, 2025 20:37
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

crates/oxide/src/scanner/allowed_paths.rs Outdated Show resolved Hide resolved
crates/oxide/src/scanner/allowed_paths.rs Outdated Show resolved Hide resolved
crates/oxide/src/scanner/allowed_paths.rs Outdated Show resolved Hide resolved
@RobinMalfait RobinMalfait force-pushed the fix/v4-better-ignore-handling branch from a33156c to c22a381 Compare January 28, 2025 15:59
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just need a changelog entry

@thecrypticace thecrypticace force-pushed the fix/v4-better-ignore-handling branch from 193192b to 8e76995 Compare January 28, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] Sources are not being taken into consideration with Next.js 15
2 participants