limit max commits view number on activity

release/v1.15
Lunny Xiao 2014-03-23 17:51:12 +08:00
parent ace20602b5
commit d6619cfe15
1 changed files with 4 additions and 0 deletions

View File

@ -262,9 +262,13 @@ func runServ(k *cli.Context) {
}
commits := make([][]string, 0)
var maxCommits = 5
for e := l.Back(); e != nil; e = e.Prev() {
commit := e.Value.(*git.Commit)
commits = append(commits, []string{commit.Id().String(), commit.Message()})
if len(commits) >= maxCommits {
break
}
}
if err = models.CommitRepoAction(user.Id, user.Name,