-
Notifications
You must be signed in to change notification settings - Fork 534
Add Repository.Log() method (fix #298) #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
=========================================
- Coverage 77.32% 77.3% -0.03%
=========================================
Files 117 117
Lines 8030 8062 +32
=========================================
+ Hits 6209 6232 +23
- Misses 1160 1164 +4
- Partials 661 666 +5
Continue to review full report at Codecov.
|
plumbing/object/commit.go
Outdated
} | ||
|
||
// StorerCommitIter provides an iterator from commits in an EncodedObjectStorer. | ||
type StorerCommitIter struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this object can be private, since we are using through the interface
plumbing/object/commit.go
Outdated
// storer.EncodedObjectIter and returns a *CommitIter that iterates over all | ||
// commits contained in the storer.EncodedObjectIter. | ||
// | ||
// Any non-commit object returned by the storer.EncodedObjectIter is skipped. | ||
func NewCommitIter(s storer.EncodedObjectStorer, iter storer.EncodedObjectIter) *CommitIter { | ||
return &CommitIter{iter, s} | ||
func NewStorerCommitIter(s storer.EncodedObjectStorer, iter storer.EncodedObjectIter) CommitIter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the implementation is private the method can be calle NewCommitIter
plumbing/object/commit.go
Outdated
@@ -271,6 +265,10 @@ func (iter *CommitIter) ForEach(cb func(*Commit) error) error { | |||
}) | |||
} | |||
|
|||
func (iter *StorerCommitIter) Close() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not tested
plumbing/object/commit.go
Outdated
@@ -292,9 +290,3 @@ func SortCommits(l []*Commit) { | |||
s := &commitSorterer{l} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not tested
options.go
Outdated
|
||
// LogOptions describes how a log action should be performed. | ||
type LogOptions struct { | ||
// From is the hash of the commit from we want to start the log history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative wording:
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.
- CommitIter is now an interface - The old CommitIter implementation is now called StorerCommitIter - CommitWalker and CommitWalkerPost are now iterators (CommitPreIterator and CommitPostIterator). - Remove Commit.History() method. There are so many ways to iterate a commit history, depending of the use case. Now, instead of use the History() method, you must use CommitPreIterator or CommitPostIterator. - Move commitSorterer to references.go because is the only place that it is used, and it must not be used into another place. - Make References method private, it must only be used into blame logic. - Added a TODO into references method, where the sortCommits is used to remove it in a near future.
Uh oh!
There was an error while loading. Please reload this page.