aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorNithin Gangadharan <nithin.linkin@gmail.com>2018-10-11 14:17:08 +0530
committerMáximo Cuadros <mcuadros@gmail.com>2018-10-11 10:47:08 +0200
commit0bfe038a16551ede1d22bfb54f52c31b646a9e1a (patch)
tree15a56ea438a779c88667bb6071bf4462eb4d1610 /repository.go
parent299f583fdb7fd3501ba496fbf5f5c517d46efcc8 (diff)
downloadgo-git-0bfe038a16551ede1d22bfb54f52c31b646a9e1a.tar.gz
Plumbing: object, Add support for Log with filenames. Fixes #826 (#979)
plumbing: object, Add support for Log with filenames. Fixes #826
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/repository.go b/repository.go
index be1f057..62e22a6 100644
--- a/repository.go
+++ b/repository.go
@@ -965,19 +965,26 @@ func (r *Repository) Log(o *LogOptions) (object.CommitIter, error) {
return nil, err
}
+ var commitIter object.CommitIter
switch o.Order {
case LogOrderDefault:
- return object.NewCommitPreorderIter(commit, nil, nil), nil
+ commitIter = object.NewCommitPreorderIter(commit, nil, nil)
case LogOrderDFS:
- return object.NewCommitPreorderIter(commit, nil, nil), nil
+ commitIter = object.NewCommitPreorderIter(commit, nil, nil)
case LogOrderDFSPost:
- return object.NewCommitPostorderIter(commit, nil), nil
+ commitIter = object.NewCommitPostorderIter(commit, nil)
case LogOrderBSF:
- return object.NewCommitIterBSF(commit, nil, nil), nil
+ commitIter = object.NewCommitIterBSF(commit, nil, nil)
case LogOrderCommitterTime:
- return object.NewCommitIterCTime(commit, nil, nil), nil
+ commitIter = object.NewCommitIterCTime(commit, nil, nil)
+ default:
+ return nil, fmt.Errorf("invalid Order=%v", o.Order)
+ }
+
+ if o.FileName == nil {
+ return commitIter, nil
}
- return nil, fmt.Errorf("invalid Order=%v", o.Order)
+ return object.NewCommitFileIterFromIter(*o.FileName, commitIter), nil
}
// Tags returns all the tag References in a repository.