]> source.dussan.org Git - gitea.git/commitdiff
Page: Commits and fix #249
authorUnknwon <joe2010xtmf@163.com>
Wed, 24 Sep 2014 03:18:14 +0000 (23:18 -0400)
committerUnknwon <joe2010xtmf@163.com>
Wed, 24 Sep 2014 03:18:14 +0000 (23:18 -0400)
models/user.go

index c09a77265f7adffdaddc6e38c2436ce006e1890d..49f8387d7934d9cbe812af819b8d16ec162c6b17 100644 (file)
@@ -522,15 +522,21 @@ type UserCommit struct {
 
 // ValidCommitsWithEmails checks if authors' e-mails of commits are correcponding to users.
 func ValidCommitsWithEmails(oldCommits *list.List) *list.List {
+       emails := map[string]string{}
        newCommits := list.New()
        e := oldCommits.Front()
        for e != nil {
                c := e.Value.(*git.Commit)
 
                uname := ""
-               u, err := GetUserByEmail(c.Author.Email)
-               if err == nil {
-                       uname = u.Name
+               if v, ok := emails[c.Author.Email]; !ok {
+                       u, err := GetUserByEmail(c.Author.Email)
+                       if err == nil {
+                               uname = u.Name
+                       }
+                       emails[c.Author.Email] = uname
+               } else {
+                       uname = v
                }
 
                newCommits.PushBack(UserCommit{