aboutsummaryrefslogtreecommitdiffstats
path: root/options.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-03-12 09:38:00 +0100
committerGitHub <noreply@github.com>2018-03-12 09:38:00 +0100
commit1d28459504251497e0ce6132a0fadd5eb44ffd22 (patch)
treedd56e4f69f58e0988cd87b5a221e2e6e88b5904c /options.go
parentecda5c1512bcb19e1802d629b18872ec995e23cf (diff)
parent3b75e0c904a81069d623a3361954242c668f496d (diff)
downloadgo-git-1d28459504251497e0ce6132a0fadd5eb44ffd22.tar.gz
Merge pull request #771 from ilius/PR-log-orderv4.2.0
repository.Log: add alternatives for commit traversal order
Diffstat (limited to 'options.go')
-rw-r--r--options.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/options.go b/options.go
index a87b497..f0c2fd8 100644
--- a/options.go
+++ b/options.go
@@ -307,12 +307,27 @@ func (o *ResetOptions) Validate(r *Repository) error {
return nil
}
+type LogOrder int8
+
+const (
+ LogOrderDefault LogOrder = iota
+ LogOrderDFS
+ LogOrderDFSPost
+ LogOrderBSF
+ LogOrderCommitterTime
+)
+
// LogOptions describes how a log action should be performed.
type LogOptions struct {
// When the From option is set the log will only contain commits
// reachable from it. If this option is not set, HEAD will be used as
// the default From.
From plumbing.Hash
+
+ // The default traversal algorithm is Depth-first search
+ // set Order=LogOrderCommitterTime for ordering by committer time (more compatible with `git log`)
+ // set Order=LogOrderBSF for Breadth-first search
+ Order LogOrder
}
var (