summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-16 20:43:19 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-16 20:43:19 -0600
commit90fa2795ad177b9add2fe46382576993e96ece4b (patch)
tree0e2847f8694fa66a914680329c4515101b5a45ab /commit.go
Initial commit
Gemini repository browsing
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go33
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")
+}