Page: Commits and fix #249

release/v1.15
Unknwon 2014-09-23 23:18:14 -04:00
parent 5bbeeb0f1b
commit bd55b78775
1 changed files with 9 additions and 3 deletions

View File

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