matchUsersWithCommitEmails matches existing users using commit author emails.
(ctx gocontext.Context, oldCommits []*git.Commit)
| 191 | |
| 192 | // matchUsersWithCommitEmails matches existing users using commit author emails. |
| 193 | func matchUsersWithCommitEmails(ctx gocontext.Context, oldCommits []*git.Commit) []*userCommit { |
| 194 | emailToUsers := make(map[string]*database.User) |
| 195 | newCommits := make([]*userCommit, len(oldCommits)) |
| 196 | usersStore := database.Handle.Users() |
| 197 | for i := range oldCommits { |
| 198 | var u *database.User |
| 199 | if v, ok := emailToUsers[oldCommits[i].Author.Email]; !ok { |
| 200 | u, _ = usersStore.GetByEmail(ctx, oldCommits[i].Author.Email) |
| 201 | emailToUsers[oldCommits[i].Author.Email] = u |
| 202 | } else { |
| 203 | u = v |
| 204 | } |
| 205 | |
| 206 | newCommits[i] = &userCommit{ |
| 207 | User: u, |
| 208 | Commit: oldCommits[i], |
| 209 | } |
| 210 | } |
| 211 | return newCommits |
| 212 | } |
| 213 | |
| 214 | func CompareDiff(c *context.Context) { |
| 215 | c.Data["IsDiffCompare"] = true |
no test coverage detected