From b8368f98ffc79a6c6c7bceed50a2989049d3eb1a Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 26 Sep 2014 08:55:13 -0400 Subject: Add directory level commit message --- models/user.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'models') diff --git a/models/user.go b/models/user.go index f327ed1440..8aa349c8a8 100644 --- a/models/user.go +++ b/models/user.go @@ -521,8 +521,17 @@ type UserCommit struct { *git.Commit } -// ValidCommitsWithEmails checks if authors' e-mails of commits are correcponding to users. -func ValidCommitsWithEmails(oldCommits *list.List) *list.List { +// ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user. +func ValidateCommitWithEmail(c *git.Commit) (uname string) { + u, err := GetUserByEmail(c.Author.Email) + if err == nil { + uname = u.Name + } + return uname +} + +// ValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users. +func ValidateCommitsWithEmails(oldCommits *list.List) *list.List { emails := map[string]string{} newCommits := list.New() e := oldCommits.Front() -- cgit v1.2.3