summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-09-23 23:18:14 -0400
committerUnknwon <joe2010xtmf@163.com>2014-09-23 23:18:14 -0400
commitbd55b78775f8dd04448d30e32f175918ee2b702e (patch)
tree9a7c81111bd3f4744d43a5d96ebb96f5d943f2ac /models
parent5bbeeb0f1b5cecb67e1527410a45fb65df0096d1 (diff)
downloadgitea-bd55b78775f8dd04448d30e32f175918ee2b702e.tar.gz
gitea-bd55b78775f8dd04448d30e32f175918ee2b702e.zip
Page: Commits and fix #249
Diffstat (limited to 'models')
-rw-r--r--models/user.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go
index c09a77265f..49f8387d79 100644
--- a/models/user.go
+++ b/models/user.go
@@ -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{