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 traverse gitignored dirs for gitignore files #397
Don't traverse gitignored dirs for gitignore files #397
Conversation
this seems to be an upstream issue in go-git, and i'll prepare a PR for them soon, but for now this copies in the affected method and fixes it by checking the accumulated patterns while walking the fs looking for gitignore files fixes: google#389
96e1d81
to
f32a631
Compare
Thank you! The gitignore while traversing fix looks good, though we still should ignore sub-directories when the |
Hi @another-rex. Do you mean
or
|
I think I meant the second option. If the recursive option is not passed in, we shouldn't look in sub-directories for gitignore files (since it'll never apply to what is being scanned). So the only
Huh TIL about |
Thanks for the clarification @another-rex . So you preference is for the command
to pick up:
but not
Is that about right? |
There's also a
which we haven't imported into this code. |
Yep, specifically to not even traverse the subdirs to find those .gitignore files. |
Huh... Let's not worry about those ignores for now until we can update upstream then. I originally thought we got that for free with the go git library, but since we are copying it in, happy to just focus on .gitignore files for now. |
Updated version of #397. > this seems to be an upstream issue in go-git, and i'll prepare a PR for them soon, but for now this copies in the affected function and fixes it by checking the accumulated patterns while walking the fs looking for gitignore files > > fixes: #389 - is located github.com/**ackama**/osv-scanner, rather than github.com/**robotdana**/osv-scanner - has tests - has extra changes to handle #397 (comment) (handles mid-tree dirs, handles non-git dirs, handles recursive flag) --------- Co-authored-by: Dana Sherson <robot@dana.sh> Co-authored-by: Rex P <106129829+another-rex@users.noreply.github.com> Co-authored-by: Gareth Jones <Jones258@Gmail.com>
this seems to be an upstream issue in go-git, and i'll prepare a PR for them soon, but for now this copies in the affected function and fixes it by checking the accumulated patterns while walking the fs looking for gitignore files
fixes: #389