diff options
author | Saeed Rasooli <saeed.gnu@gmail.com> | 2019-11-29 13:39:29 +0330 |
---|---|---|
committer | Saeed Rasooli <saeed.gnu@gmail.com> | 2019-11-29 16:46:44 +0330 |
commit | 224f047f4f95b44434f84303746c37439929e02b (patch) | |
tree | c5e20545bedd8da274e8dff25b5b0d71771ab05c /repository.go | |
parent | f54ee6d2b1f92d67ed567027f7a8ec1f2139c532 (diff) | |
download | go-git-224f047f4f95b44434f84303746c37439929e02b.tar.gz |
add `PathFilter func(string) bool` to LogOptions
Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/repository.go b/repository.go index 2bb2afb..1e3e339 100644 --- a/repository.go +++ b/repository.go @@ -1067,6 +1067,9 @@ func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) { // for `git log --all` also check parent (if the next commit comes from the real parent) it = r.logWithFile(*o.FileName, it, o.All) } + if o.PathFilter != nil { + it = r.logWithPathFilter(o.PathFilter, it, o.All) + } if o.Since != nil || o.Until != nil { limitOptions := object.LogLimitOptions{Since: o.Since, Until: o.Until} @@ -1108,6 +1111,14 @@ func (*Repository) logWithFile(fileName string, commitIter object.CommitIter, ch ) } +func (*Repository) logWithPathFilter(pathFilter func(string) bool, commitIter object.CommitIter, checkParent bool) object.CommitIter { + return object.NewCommitPathIterFromIter( + pathFilter, + commitIter, + checkParent, + ) +} + func (*Repository) logWithLimit(commitIter object.CommitIter, limitOptions object.LogLimitOptions) object.CommitIter { return object.NewCommitLimitIterFromIter(commitIter, limitOptions) } |