blob: c7a102d796e385405099c2e513303b1dec558fa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package syw
import (
"strings"
"time"
)
type Commit struct {
Repo *Repository
Hash string
Parents []string
CommitterName string
CommitterEmail string
CommitDate time.Time
AuthorName string
AuthorEmail string
AuthorDate time.Time
Message string
}
func (c *Commit) ParentHash() string {
return c.Hash + "^"
}
func (c *Commit) ShortMessage() string {
short, _, _ := strings.Cut(c.Message, "\n")
return short
}
func (c *Commit) RestOfMessage() string {
_, rest, _ := strings.Cut(c.Message, "\n")
return strings.TrimPrefix(rest, "\n")
}
|