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

Excluding directories also excludes similarly-named files #5

Closed
kashav opened this issue May 15, 2017 · 4 comments
Closed

Excluding directories also excludes similarly-named files #5

kashav opened this issue May 15, 2017 · 4 comments
Labels

Comments

@kashav
Copy link
Owner

kashav commented May 15, 2017

For example, excluding .git (with -.git) results in .gitignore not being listed.

This can be resolved with excluding with -.git/ instead, but then .git is listed.

@kashav kashav added the bug label May 15, 2017
@kashav kashav mentioned this issue May 15, 2017
11 tasks
@kashav kashav changed the title Bug: Excluding directories also excludes similarly-named files Excluding directories also excludes similarly-named files May 15, 2017
@ghost
Copy link

ghost commented May 21, 2017

Mind if I take this one? I see you have a branch with some refactorings. Not sure if you've tackled it there, but I've identified that it could be a problem with the logic in:
main::containsAny(exclusions []string, path string)

It may be simpler to use the os.FileInfo that we have access to, to do directory Vs file comparison edge cases.

Let me know if there are any other considerations that you've thought about!

@ghost
Copy link

ghost commented May 21, 2017

Very cool project btw!

@kashav
Copy link
Owner Author

kashav commented May 21, 2017

@jonesbrianc26 Go for it!

Ended up moving the logic for this to query.Execute. I suggest working off the new branch, but feel free to work off master if you prefer (it'll be the same fix either way).

So from what I can tell, the problem comes from my naive method of checking if the file path string contains the excluded directory, i.e. .gitignore contains .git, so it's ignored for -.git, whereas it doesn't contain .git/, so it isn't ignored for -.git/.

I haven't really given this much thought yet, but there might be a method to solve this with regular expressions.

I look forward to seeing what you come up with!

@kashav
Copy link
Owner Author

kashav commented May 24, 2017

Resolved in #21! 😄

@kashav kashav closed this as completed May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant