pkg/diff: respect global .gitignore#25
Merged
joelanford merged 1 commit intojoelanford:mainfrom Aug 28, 2023
Merged
Conversation
Contributor
Author
|
@joelanford can you take a look at the PR? Thanks! |
joelanford
reviewed
Jul 24, 2023
pkg/diff/run.go
Outdated
Comment on lines
+61
to
+77
| wt.Excludes, err = gitignore.LoadGlobalPatterns(wt.Filesystem) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to load global gitignore: %v", err) | ||
| } | ||
|
|
Owner
There was a problem hiding this comment.
A few things:
- We should append to
wt.Excludes, not override it. - The filesystem passed in should be the OS root (not the repo path)
See the following for an example: https://github.com/apache/skywalking-eyes/blob/5dfa68f93380a5e57259faaf95088b7f133b5778/pkg/header/check.go#L84-L94
Respect patterns from ~/.gitignore, /etc/gitconfig or core.excludesFile if present. This avoids the "current git tree is dirty" in some circumstances. Fixes joelanford#20 Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
c4100a4 to
bc12a29
Compare
Owner
|
Looks great! Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Respect patterns from ~/.gitignore or core.excludesFile if present. This avoids the "current git tree is dirty" in some circumstances.
Fixes #20