From 90fa2795ad177b9add2fe46382576993e96ece4b Mon Sep 17 00:00:00 2001 From: tjpcc Date: Sat, 16 Sep 2023 20:43:19 -0600 Subject: Initial commit Gemini repository browsing --- commit.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 commit.go (limited to 'commit.go') 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") +} -- cgit v1.2.3