From c7fc75ef6ebd7127e0918b1669d336ba39844201 Mon Sep 17 00:00:00 2001 From: knqyf263 Date: Sat, 3 Aug 2019 16:30:58 -1000 Subject: Add limiting options to git log Signed-off-by: knqyf263 --- _examples/log/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '_examples') 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 -- cgit