commit.go

 1package git
 2
 3import (
 4	"github.com/gogs/git-module"
 5)
 6
 7// ZeroID is the zero hash.
 8const ZeroID = git.EmptyID
 9
10// Commit is a wrapper around git.Commit with helper methods.
11type Commit = git.Commit
12
13// Commits is a list of commits.
14type Commits []*Commit
15
16// Len implements sort.Interface.
17func (cl Commits) Len() int { return len(cl) }
18
19// Swap implements sort.Interface.
20func (cl Commits) Swap(i, j int) { cl[i], cl[j] = cl[j], cl[i] }
21
22// Less implements sort.Interface.
23func (cl Commits) Less(i, j int) bool {
24	return cl[i].Author.When.After(cl[j].Author.When)
25}