-
Notifications
You must be signed in to change notification settings - Fork 363
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
Make scanner respect .gitignore files #191
Conversation
fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for switching the git os calls over to the library as well!
Do you think it's worth it to implement the subdir .gitignore scanning as well now? Or push it to a later PR. I think it does do the subdirectory ignores now after reading through it again. Is that right?
pkg/osvscanner/osvscanner.go
Outdated
// We need to parse .gitignore files from the root of the git repo to correctly identify ignored files | ||
// Defaults to current directory if dir is not in a repo or some other error | ||
// TODO: Won't parse ignores if dir is not in a git repo, and is not under the current directory (e.g ../path/to) | ||
// TODO: What is the desired behaviour for non git-repos? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current behavior of defaulting to current dir as the root is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool - removed that TODO
Yep - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment.
func parseGitIgnores(dir string) (*gitIgnoreMatcher, error) { | ||
// We need to parse .gitignore files from the root of the git repo to correctly identify ignored files | ||
// Defaults to current directory if dir is not in a repo or some other error | ||
// TODO: Won't parse ignores if dir is not in a git repo, and is not under the current directory (e.g ../path/to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a bug to track this? By "current directory", do you mean "current working directory"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made #202
Closes google#165 Also changes `GetCommitSHA` to no longer rely on the system's git executable. By default, OSV-Scanner will skip files/directories that are ignored by a git project's `.gitignore` files. Added a flag `--no-ignore` to disable this behaviour.
Closes #165 Also changes `GetCommitSHA` to no longer rely on the system's git executable. By default, OSV-Scanner will skip files/directories that are ignored by a git project's `.gitignore` files. Added a flag `--no-ignore` to disable this behaviour.
Closes google#165 Also changes `GetCommitSHA` to no longer rely on the system's git executable. By default, OSV-Scanner will skip files/directories that are ignored by a git project's `.gitignore` files. Added a flag `--no-ignore` to disable this behaviour.
Closes google#165 Also changes `GetCommitSHA` to no longer rely on the system's git executable. By default, OSV-Scanner will skip files/directories that are ignored by a git project's `.gitignore` files. Added a flag `--no-ignore` to disable this behaviour.
Closes #165
Also changes
GetCommitSHA
to no longer rely on the system's git executable.By default, OSV-Scanner will skip files/directories that are ignored by a git project's
.gitignore
files. Added a flag--no-ignore
to disable this behaviour.