diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-09-26 08:55:13 -0400 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-09-26 08:55:13 -0400 |
commit | b8368f98ffc79a6c6c7bceed50a2989049d3eb1a (patch) | |
tree | eb6918a6539cfa68b6cc4a582c21fd0e3e4d2348 /models | |
parent | 3164354255a01e98b1c5d4d668c3b1c62474b240 (diff) | |
download | gitea-b8368f98ffc79a6c6c7bceed50a2989049d3eb1a.tar.gz gitea-b8368f98ffc79a6c6c7bceed50a2989049d3eb1a.zip |
Add directory level commit message
Diffstat (limited to 'models')
-rw-r--r-- | models/user.go | 13 |
1 files changed, 11 insertions, 2 deletions
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() |