aboutsummaryrefslogtreecommitdiffstats
path: root/_examples/log
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2019-08-05 12:19:40 +0200
committerGitHub <noreply@github.com>2019-08-05 12:19:40 +0200
commit2661d86e26b9adb99ff37a82d6984030000639dd (patch)
tree3511322c02b495d4b06cdeacc669bbf822a4708c /_examples/log
parenta0c8105a91910a022fe2b8d154f0a9ee777f7310 (diff)
parentc7fc75ef6ebd7127e0918b1669d336ba39844201 (diff)
downloadgo-git-2661d86e26b9adb99ff37a82d6984030000639dd.tar.gz
Merge pull request #1206 from knqyf263/feature/add_log_limiting
Add limiting options to git log
Diffstat (limited to '_examples/log')
-rw-r--r--_examples/log/main.go5
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