Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/hudson/plugins/git/GitChangeSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,14 @@ public User findOrCreateUser(String csAuthor, String csAuthorEmail, boolean crea
}
}
} else {
if (useExistingAccountWithSameEmail && hasMailerPlugin()) {
for(User existingUser : User.getAll()) {
if (csAuthorEmail.equalsIgnoreCase(getMail(existingUser))) {
return existingUser;
}
}
}

if (csAuthor.isEmpty()) {
// Avoid exception from User.get("", false)
return User.getUnknown();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/hudson/plugins/git/GitChangeSetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void testFindOrCreateUserBasedOnExistingUsersEmail() throws IOException {
final String existingUserId = "An existing user";
final String existingUserFullName = "Some FullName";
final String email = "[email protected]";
final boolean createAccountBasedOnEmail = true;
final boolean createAccountBasedOnEmail = random.nextBoolean();
final boolean useExistingAccountBasedOnEmail = true;

assertNull(User.get(email, false));
Expand Down