diff options
author | knqyf263 <knqyf263@gmail.com> | 2019-08-03 16:30:58 -1000 |
---|---|---|
committer | knqyf263 <knqyf263@gmail.com> | 2019-08-04 23:27:33 -1000 |
commit | c7fc75ef6ebd7127e0918b1669d336ba39844201 (patch) | |
tree | 3511322c02b495d4b06cdeacc669bbf822a4708c /_examples | |
parent | a0c8105a91910a022fe2b8d154f0a9ee777f7310 (diff) | |
download | go-git-c7fc75ef6ebd7127e0918b1669d336ba39844201.tar.gz |
Add limiting options to git log
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Diffstat (limited to '_examples')
-rw-r--r-- | _examples/log/main.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/_examples/log/main.go b/_examples/log/main.go index ba0597a..5807515 100644 --- a/_examples/log/main.go +++ b/_examples/log/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "time" "gopkg.in/src-d/go-git.v4" . "gopkg.in/src-d/go-git.v4/_examples" @@ -31,7 +32,9 @@ func main() { CheckIfError(err) // ... retrieves the commit history - cIter, err := r.Log(&git.LogOptions{From: ref.Hash()}) + since := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) + until := time.Date(2019, 7, 30, 0, 0, 0, 0, time.UTC) + cIter, err := r.Log(&git.LogOptions{From: ref.Hash(), Since: &since, Until: &until}) CheckIfError(err) // ... just iterates over the commits, printing it |