summaryrefslogtreecommitdiff
path: root/pkg/git/git.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2026-01-30 18:01:41 -0700
committermo khan <mo@mokhan.ca>2026-01-30 18:01:41 -0700
commitff213f4113434fee4ddba1f0874d3c2c99b4f9de (patch)
treebfb5a53fb1768f350880fbd94c9a2ed1cdb38272 /pkg/git/git.go
parentc60b386be0078c86a2c8f7de3c85ca98dd7e357c (diff)
feat: add json and atom feeds
Diffstat (limited to 'pkg/git/git.go')
-rw-r--r--pkg/git/git.go34
1 files changed, 23 insertions, 11 deletions
diff --git a/pkg/git/git.go b/pkg/git/git.go
index 4fd551a..1e05d60 100644
--- a/pkg/git/git.go
+++ b/pkg/git/git.go
@@ -224,6 +224,9 @@ func Commits(ref Ref, repoDir string) ([]Commit, error) {
"%an", // author name
"%ae", // author email
"%ad", // author date
+ "%cn", // committer name
+ "%ce", // committer email
+ "%cd", // committer date
"%P", // parent hashes
"%D", // ref names without the "(", ")" wrapping.
}
@@ -256,22 +259,31 @@ func Commits(ref Ref, repoDir string) ([]Commit, error) {
if len(parts) != len(format) {
return nil, fmt.Errorf("unexpected commit format: %s", line)
}
- full, short, subject, body, author, email, date, parents, refs :=
- parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6], parts[7], parts[8]
+ full, short, subject, body, author, email, date :=
+ parts[0], parts[1], parts[2], parts[3], parts[4], parts[5], parts[6]
+ committerName, committerEmail, committerDate, parents, refs :=
+ parts[7], parts[8], parts[9], parts[10], parts[11]
timestamp, err := strconv.Atoi(date)
if err != nil {
return nil, fmt.Errorf("failed to parse commit date: %w", err)
}
+ committerTimestamp, err := strconv.Atoi(committerDate)
+ if err != nil {
+ return nil, fmt.Errorf("failed to parse committer date: %w", err)
+ }
commits = append(commits, Commit{
- Hash: full,
- ShortHash: short,
- Subject: subject,
- Body: body,
- Author: author,
- Email: email,
- Date: time.Unix(int64(timestamp), 0),
- Parents: strings.Fields(parents),
- RefNames: parseRefNames(refs),
+ Hash: full,
+ ShortHash: short,
+ Subject: subject,
+ Body: body,
+ Author: author,
+ Email: email,
+ Date: time.Unix(int64(timestamp), 0),
+ CommitterName: committerName,
+ CommitterEmail: committerEmail,
+ CommitterDate: time.Unix(int64(committerTimestamp), 0),
+ Parents: strings.Fields(parents),
+ RefNames: parseRefNames(refs),
})
}
return commits, nil