Fix recognition of reviewers in commit message tags
A bug in JGit's footer match method caused "Sample-Bug-Id: 42" to be treated identical to the footer line "Signed-off-by: 42". Since Signed-off-by tags are converted into reviewers, we were adding account number 42 as a reviewer anytime we saw "Sample-Bug-Id: 42". This happened for any footer line key, so long as its length matched the length of "Signed-off-by". This was fixed in a newer version of JGit, so upgrade. Also prevent "Signed-off-by: 42" from being treated as an account. Within a commit message, we only want to match to a reviewer by their full name or their email address. Matching on their internal database id number isn't useful. Bug: issue 553 Change-Id: Ie26974240f26d29fb55cd95dc6b6c72c89903f37 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -45,8 +45,9 @@ public class AccountResolver {
|
||||
* Locate exactly one account matching the name or name/email string.
|
||||
*
|
||||
* @param nameOrEmail a string of the format
|
||||
* "Full Name <email@example>", or just the email address
|
||||
* ("email@example"), or a full name, or an account id.
|
||||
* "Full Name <email@example>", just the email address
|
||||
* ("email@example"), a full name ("Full Name"), or an account id
|
||||
* ("18419").
|
||||
* @return the single account that matches; null if no account matches or
|
||||
* there are multiple candidates.
|
||||
*/
|
||||
@@ -60,6 +61,20 @@ public class AccountResolver {
|
||||
return byId.get(Account.Id.parse(nameOrEmail)).getAccount();
|
||||
}
|
||||
|
||||
return findByNameOrEmail(nameOrEmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate exactly one account matching the name or name/email string.
|
||||
*
|
||||
* @param nameOrEmail a string of the format
|
||||
* "Full Name <email@example>", just the email address
|
||||
* ("email@example"), a full name ("Full Name").
|
||||
* @return the single account that matches; null if no account matches or
|
||||
* there are multiple candidates.
|
||||
*/
|
||||
public Account findByNameOrEmail(final String nameOrEmail)
|
||||
throws OrmException {
|
||||
final int lt = nameOrEmail.indexOf('<');
|
||||
final int gt = nameOrEmail.indexOf('>');
|
||||
if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) {
|
||||
|
Reference in New Issue
Block a user