aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorknqyf263 <knqyf263@gmail.com>2019-08-03 16:30:58 -1000
committerknqyf263 <knqyf263@gmail.com>2019-08-04 23:27:33 -1000
commitc7fc75ef6ebd7127e0918b1669d336ba39844201 (patch)
tree3511322c02b495d4b06cdeacc669bbf822a4708c /repository.go
parenta0c8105a91910a022fe2b8d154f0a9ee777f7310 (diff)
downloadgo-git-c7fc75ef6ebd7127e0918b1669d336ba39844201.tar.gz
Add limiting options to git log
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/repository.go b/repository.go
index 2251d6c..11269ef 100644
--- a/repository.go
+++ b/repository.go
@@ -1068,6 +1068,11 @@ func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) {
it = r.logWithFile(*o.FileName, it, o.All)
}
+ if o.Since != nil || o.Until != nil {
+ limitOptions := object.LogLimitOptions{Since: o.Since, Until: o.Until}
+ it = r.logWithLimit(it, limitOptions)
+ }
+
return it, nil
}
@@ -1097,6 +1102,10 @@ func (*Repository) logWithFile(fileName string, commitIter object.CommitIter, ch
return object.NewCommitFileIterFromIter(fileName, commitIter, checkParent)
}
+func (*Repository) logWithLimit(commitIter object.CommitIter, limitOptions object.LogLimitOptions) object.CommitIter {
+ return object.NewCommitLimitIterFromIter(commitIter, limitOptions)
+}
+
func commitIterFunc(order LogOrder) func(c *object.Commit) object.CommitIter {
switch order {
case LogOrderDefault: