Skip to content

Commit a0a45e9

Browse files
committed
fix: added author data to the commit info
1 parent 524456f commit a0a45e9

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

git.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ type GitWatcher struct {
3737

3838
// GitCommit is the object that contains the info about the commit
3939
type GitCommit struct {
40-
Hash string
41-
Message string
42-
Branch string
40+
Hash string
41+
Message string
42+
Branch string
43+
AuthorName string
44+
AuthorEmail string
45+
Time time.Time
4346
}
4447

4548
// GitObject is the object that contains the info of the file
@@ -288,19 +291,25 @@ func (w *GitWatcher) checkCommits(disableNotification bool) {
288291
}
289292

290293
commit := &GitCommit{
291-
Hash: c.Hash.String(),
292-
Message: c.Message,
293-
Branch: branch,
294+
Hash: c.Hash.String(),
295+
Message: c.Message,
296+
AuthorName: c.Author.Name,
297+
AuthorEmail: c.Author.Email,
298+
Time: c.Author.When,
299+
Branch: branch,
294300
}
295301
commits = append(commits, commit)
296302
} else {
297303
// this is the first time we see this branch.
298304
// Storing only the last commit's hash because
299305
// we can't know from what other branch it comes
300306
commit := &GitCommit{
301-
Hash: c.Hash.String(),
302-
Message: c.Message,
303-
Branch: branch,
307+
Hash: c.Hash.String(),
308+
Message: c.Message,
309+
AuthorName: c.Author.Name,
310+
AuthorEmail: c.Author.Email,
311+
Time: c.Author.When,
312+
Branch: branch,
304313
}
305314
commits = append(commits, commit)
306315
return errExitFromLoop

0 commit comments

Comments
 (0)