diff options
Diffstat (limited to 'commit.go')
-rw-r--r-- | commit.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/commit.go b/commit.go new file mode 100644 index 0000000..d10dc6d --- /dev/null +++ b/commit.go @@ -0,0 +1,33 @@ +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) 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") +} |