aboutsummaryrefslogtreecommitdiffstats
path: root/repository.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 /repository.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 'repository.go')
-rw-r--r--repository.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/repository.go b/repository.go
index 24d025d..98558d9 100644
--- a/repository.go
+++ b/repository.go
@@ -728,7 +728,19 @@ func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) {
return nil, err
}
- return object.NewCommitPreorderIter(commit, nil, nil), nil
+ switch o.Order {
+ case LogOrderDefault:
+ return object.NewCommitPreorderIter(commit, nil, nil), nil
+ case LogOrderDFS:
+ return object.NewCommitPreorderIter(commit, nil, nil), nil
+ case LogOrderDFSPost:
+ return object.NewCommitPostorderIter(commit, nil), nil
+ case LogOrderBSF:
+ return object.NewCommitIterBSF(commit, nil, nil), nil
+ case LogOrderCommitterTime:
+ return object.NewCommitIterCTime(commit, nil, nil), nil
+ }
+ return nil, fmt.Errorf("invalid Order=%v", o.Order)
}
// Tags returns all the References from Tags. This method returns all the tag