Avoid change find mismatch
In servers with a big number of changes the legacy-id can have 7 or more digits and the sha-1 regex will match and return change not found if there is not a commit in the project starting with the exact same sequence of digits, which is a remote possibility. Check first for legacy-id so sequences of digits are taken as legacy-id. Change-Id: Ibb87b22f2e8efeb025031fa61ebd27d8b5d90156
This commit is contained in:
parent
61610881aa
commit
1ac64e318f
|
@ -54,11 +54,6 @@ public class ChangeFinder {
|
|||
// to force rereading in case the index is stale.
|
||||
InternalChangeQuery query = queryProvider.get().noFields();
|
||||
|
||||
//Try commit hash
|
||||
if (id.matches("^([0-9a-fA-F]{" + RevId.ABBREV_LEN + "," + RevId.LEN + "})$")) {
|
||||
return asChangeControls(query.byCommit(id), user);
|
||||
}
|
||||
|
||||
// Try legacy id
|
||||
if (!id.isEmpty() && id.charAt(0) != '0') {
|
||||
Integer n = Ints.tryParse(id);
|
||||
|
@ -67,6 +62,11 @@ public class ChangeFinder {
|
|||
}
|
||||
}
|
||||
|
||||
// Try commit hash
|
||||
if (id.matches("^([0-9a-fA-F]{" + RevId.ABBREV_LEN + "," + RevId.LEN + "})$")) {
|
||||
return asChangeControls(query.byCommit(id), user);
|
||||
}
|
||||
|
||||
// Try isolated changeId
|
||||
if (!id.contains("~")) {
|
||||
return asChangeControls(query.byKeyPrefix(id), user);
|
||||
|
|
Loading…
Reference in New Issue