MCPcopy Create free account
hub / github.com/go-git/go-git / Less

Method Less

plumbing/object/commit.go:438–443  ·  view source on GitHub ↗

Less defines a compare function to determine which commit is 'earlier' by: - First use Committer.When - If Committer.When are equal then use Author.When - If Author.When also equal then compare the string value of the hash

(rhs *Commit)

Source from the content-addressed store, hash-verified

436// - If Committer.When are equal then use Author.When
437// - If Author.When also equal then compare the string value of the hash
438func (c *Commit) Less(rhs *Commit) bool {
439 return c.Committer.When.Before(rhs.Committer.When) ||
440 (c.Committer.When.Equal(rhs.Committer.When) &&
441 (c.Author.When.Before(rhs.Author.When) ||
442 (c.Author.When.Equal(rhs.Author.When) && bytes.Compare(c.Hash[:], rhs.Hash[:]) < 0)))
443}
444
445func indent(t string) string {
446 var output []string

Callers 1

TestLessMethod · 0.95

Calls 1

CompareMethod · 0.80

Tested by 1

TestLessMethod · 0.76