-
Notifications
You must be signed in to change notification settings - Fork 20
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
Respect .gitignore #14
Comments
Yes that sounds like a useful improvement, particularly if you can toggle that behaviour with a command line flag. Incidentally we might be able to reuse the CODEOWNERS matching logic for the gitignore files, as CODEOWNERS patterns are based on gitignore patterns. There are a few exceptions we'd need to handle, but it'd be nice to avoid taking an extra dependency. |
I'd like to work on this. I will adapt the parser with a new Switch, like I did for sections, but will wait with adapting the cmd until the section support is merged, or further adapted to your expectations. |
Another potential solution to respect gitignore: run this command to get the list of files in the repo |
Fixes hmarr#14 This commit adds support for hiding files from output that have been excluded by .gitignore and friends. I've implemented a few version of this and settled on just `git ls-files` since it's likely going to be the most correct and maintainable solution. I've tried github.com/boyter/gocodewalker but it's a complex piece of machinery and was much slower on a repo of 15k files (Cilium) than just git ls-files. I also tried out github.com/ianlewis/go-gitignore directly, but it doesn't pick up .gitignore files in subdirs automatically, nor the system-wide gitignore. I figured since the overwhelming majority of users will be running this in CI where Git will always be present, relying on the canonical .gitignore implementation (git itself) is the safest option. Signed-off-by: Timo Beckers <[email protected]>
This has been on my backlog for a few months and finally took the time to try out a few solutions yesterday. I put up some patches here: #32. Looks like the library already uses rev-parse for finding the repo root, so using |
When running
codeowners
on a typical git repository, many files are printed which are actually not part of the repository because of.gitignore
. Is that correct behavior? Would you consider that to be an improvement if this tool respects (and parses?).gitignore
if present?The text was updated successfully, but these errors were encountered: