aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/repository/commits.go10
-rw-r--r--modules/templates/helper.go5
2 files changed, 14 insertions, 1 deletions
diff --git a/modules/repository/commits.go b/modules/repository/commits.go
index 7f22105745..1558d85639 100644
--- a/modules/repository/commits.go
+++ b/modules/repository/commits.go
@@ -30,6 +30,7 @@ type PushCommits struct {
Commits []*PushCommit
HeadCommit *PushCommit
CompareURL string
+ Len int
avatars map[string]string
emailUsers map[string]*models.User
@@ -180,5 +181,12 @@ func GitToPushCommits(gitCommits []*git.Commit) *PushCommits {
for _, commit := range gitCommits {
commits = append(commits, CommitToPushCommit(commit))
}
- return &PushCommits{commits, nil, "", make(map[string]string), make(map[string]*models.User)}
+ return &PushCommits{
+ Commits: commits,
+ HeadCommit: nil,
+ CompareURL: "",
+ Len: len(commits),
+ avatars: make(map[string]string),
+ emailUsers: make(map[string]*models.User),
+ }
}
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 6517127ebf..00b07dcec9 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -819,6 +819,11 @@ func ActionContent2Commits(act Actioner) *repository.PushCommits {
if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)
}
+
+ if push.Len == 0 {
+ push.Len = len(push.Commits)
+ }
+
return push
}