aboutsummaryrefslogtreecommitdiffstats
path: root/models/update.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-12 02:29:29 -0700
committerUnknwon <u@gogs.io>2016-08-14 23:52:24 -0700
commit15845cb28763c1542556ad61d2aa9735541dbf45 (patch)
tree94b2053202fcf5270e0697fc37c38203310571ed /models/update.go
parentd0a0239bacf02eb004634dfe1bb0a3f7dfe5adb6 (diff)
downloadgitea-15845cb28763c1542556ad61d2aa9735541dbf45.tar.gz
gitea-15845cb28763c1542556ad61d2aa9735541dbf45.zip
Code clean up for new config options
Diffstat (limited to 'models/update.go')
-rw-r--r--models/update.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/models/update.go b/models/update.go
index be50a15e5a..952794538a 100644
--- a/models/update.go
+++ b/models/update.go
@@ -47,6 +47,19 @@ func DeleteUpdateTaskByUUID(uuid string) error {
return err
}
+// CommitToPushCommit transforms a git.Commit to PushCommit type.
+func CommitToPushCommit(commit *git.Commit) *PushCommit {
+ return &PushCommit{
+ Sha1: commit.ID.String(),
+ Message: commit.Message(),
+ AuthorEmail: commit.Author.Email,
+ AuthorName: commit.Author.Name,
+ CommitterEmail: commit.Committer.Email,
+ CommitterName: commit.Committer.Name,
+ Timestamp: commit.Author.When,
+ }
+}
+
func ListToPushCommits(l *list.List) *PushCommits {
commits := make([]*PushCommit, 0)
var actEmail string
@@ -55,16 +68,7 @@ func ListToPushCommits(l *list.List) *PushCommits {
if actEmail == "" {
actEmail = commit.Committer.Email
}
- commits = append(commits,
- &PushCommit{
- Sha1: commit.ID.String(),
- Message: commit.Message(),
- AuthorEmail: commit.Author.Email,
- AuthorName: commit.Author.Name,
- CommitterEmail: commit.Committer.Email,
- CommitterName: commit.Committer.Name,
- Timestamp: commit.Author.When,
- })
+ commits = append(commits, CommitToPushCommit(commit))
}
return &PushCommits{l.Len(), commits, "", nil}
}