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

fix(matcher): fix wrongly ignored paths #859

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

TaKO8Ki
Copy link
Contributor

@TaKO8Ki TaKO8Ki commented Nov 23, 2023

Summary

closes #856

When specific file or directory names are specified, it's necessary to check if they are included in the source path by traversing back through the path's ancestors. In my implementation, I use ends_with. This ends_with accurately recognizes paths, and in cases like the following, it will return false as expected:

let path = Path::new("src");
assert!(!path.ends_with("rc"));

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=33143b2b647a15d2424b2187a6411fbc

The documentation of Path::ends_with: https://doc.rust-lang.org/std/path/struct.Path.html#method.ends_with

Test Plan

I've added a test case for single file or directory name listed in .gitignore. All tests should pass.

@github-actions github-actions bot added the A-Project Area: project label Nov 23, 2023
@TaKO8Ki TaKO8Ki changed the title fix(vcs): fix wrongly ignored paths fix(matcher): fix wrongly ignored paths Nov 23, 2023
@TaKO8Ki
Copy link
Contributor Author

TaKO8Ki commented Nov 23, 2023

If it's better to try #847, I'm considering introducing the ignore crate.

@ematipico
Copy link
Member

I think we can land this fix for now.

After the release, we could start migrating to use the ignore crate. This will take more work because we want to make sure it works with the CLI, the Workspace and the memory file system we use for testing

@ematipico ematipico merged commit f32bb9e into biomejs:main Nov 23, 2023
12 checks passed
@TaKO8Ki TaKO8Ki deleted the fix-wrongly-ignored-paths branch November 23, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 File ignored when .gitignore partially matching characters are included
2 participants