1package git23import (4 "regexp"56 "github.com/aymanbagabas/git-module"7)89// ZeroID is the zero hash.10const ZeroID = git.EmptyID1112// IsZeroHash returns whether the hash is a zero hash.13func IsZeroHash(h string) bool {14 pattern := regexp.MustCompile(`^0{40,}$`)15 return pattern.MatchString(h)16}1718// Commit is a wrapper around git.Commit with helper methods.19type Commit = git.Commit2021// Commits is a list of commits.22type Commits []*Commit2324// Len implements sort.Interface.25func (cl Commits) Len() int { return len(cl) }2627// Swap implements sort.Interface.28func (cl Commits) Swap(i, j int) { cl[i], cl[j] = cl[j], cl[i] }2930// Less implements sort.Interface.31func (cl Commits) Less(i, j int) bool {32 return cl[i].Author.When.After(cl[j].Author.When)33}