-
Notifications
You must be signed in to change notification settings - Fork 534
git: worktree, add Grep() method for git grep #686
Conversation
options.go
Outdated
// GrepOptions describes how a grep should be performed. | ||
type GrepOptions struct { | ||
// Pattern is the match pattern. | ||
Pattern string |
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.
Itstead of accepting a string, I would prefer a *regexp.Regexp
with this the people can speed that the process with precompilled expressions.
options.go
Outdated
// Pattern is the match pattern. | ||
Pattern string | ||
// IgnoreCase enables case insensitive match. | ||
IgnoreCase bool |
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.
If we accept the type instead of the string, this is not need it.
worktree.go
Outdated
} | ||
|
||
// Iterate through the files and look for any matches. | ||
err = fileiter.ForEach(func(file *object.File) error { |
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 put this code in a private function?
worktree_test.go
Outdated
TreeName: "6ecf0ef2c2dffb796033e5a02219af86ec6584e5", | ||
}, | ||
}, | ||
}, |
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 prefer the open and close brace in the same line.
Signed-off-by: Sunny <me@darkowlzz.space>
Signed-off-by: Sunny <me@darkowlzz.space>
Signed-off-by: Sunny <me@darkowlzz.space>
Signed-off-by: Sunny <me@darkowlzz.space>
|
This change implemented grep on worktree with options to
match ignoring case, invert match and specify pathspec. Also, a commit hash or reference can be used to specify the worktree to search.