diff options
author | Hector Oswaldo Caballero <hector.caballero@ericsson.com> | 2017-10-18 20:16:30 -0400 |
---|---|---|
committer | Hector Oswaldo Caballero <hector.caballero@ericsson.com> | 2017-10-18 21:55:15 -0400 |
commit | 61610881aab587d19030f95a5fc5dde24bb83f58 (patch) | |
tree | a7a1a529c6b60130871145adf21bdb9d30c2afbb | |
parent | e09ae9b50a45faacff20a1a30de8eb919cc603f0 (diff) |
Fix changes not foundv2.14.5
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
-rw-r--r-- | Documentation/cmd-set-reviewers.txt | 2 | ||||
-rw-r--r-- | gerrit-server/src/main/java/com/google/gerrit/server/ChangeFinder.java | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Documentation/cmd-set-reviewers.txt b/Documentation/cmd-set-reviewers.txt index f8a272dad9..eb4335b224 100644 --- a/Documentation/cmd-set-reviewers.txt +++ b/Documentation/cmd-set-reviewers.txt @@ -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 diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeFinder.java b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeFinder.java index fa68473915..b6222a40ad 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeFinder.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeFinder.java @@ -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); } |