Fix changes not found

I7530cd604 tried to re-introduce the possibility of accepting a commit
as as argument to the SetReviewersCommand. The problem is, the regex
can match also a legacy-id greater than 1000, breaking the finder.

Accept a minimum of 7 characters for the sha-1 as the possibility of
having a sha-1 starting with seven consecutive digits is pretty low
(about 3%).

Change-Id: If1390ed73e095f739386d022439ed3b1f98931b2
This commit is contained in:
Hector Oswaldo Caballero 2017-10-18 20:16:30 -04:00
parent e09ae9b50a
commit 61610881aa
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ notifications when changes are made.
Changes can be specified in the
link:rest-api-changes.html#change-id[same format] supported by the REST
API, as well as with the commit SHA-1.
API, as well as with the commit SHA-1 (at least the 7 first characters).
== OPTIONS

View File

@ -55,7 +55,7 @@ public class ChangeFinder {
InternalChangeQuery query = queryProvider.get().noFields();
//Try commit hash
if (id.matches("^([0-9a-fA-F]{4," + RevId.LEN + "})$")) {
if (id.matches("^([0-9a-fA-F]{" + RevId.ABBREV_LEN + "," + RevId.LEN + "})$")) {
return asChangeControls(query.byCommit(id), user);
}