Do not attempt to resolve describe-labels with less than four digits
Change-Id: I21dcd3cca3b41102fd898238d8d640dea25e0caf Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
This commit is contained in:
parent
654f7235ec
commit
602c869d7a
|
@ -191,6 +191,10 @@ public void testParseNonGitDescribe() throws IOException {
|
||||||
|
|
||||||
assertEquals(id, db.resolve("refs/heads/foo-g032c"));
|
assertEquals(id, db.resolve("refs/heads/foo-g032c"));
|
||||||
assertEquals(id, db.resolve("foo-g032c"));
|
assertEquals(id, db.resolve("foo-g032c"));
|
||||||
|
assertNull(db.resolve("foo-g032"));
|
||||||
|
assertNull(db.resolve("foo-g03"));
|
||||||
|
assertNull(db.resolve("foo-g0"));
|
||||||
|
assertNull(db.resolve("foo-g"));
|
||||||
|
|
||||||
ru = db.updateRef("refs/heads/foo-g032c-dev");
|
ru = db.updateRef("refs/heads/foo-g032c-dev");
|
||||||
ru.setNewObjectId(id);
|
ru.setNewObjectId(id);
|
||||||
|
|
|
@ -599,7 +599,7 @@ private ObjectId resolveSimple(final String revstr) throws IOException {
|
||||||
return resolveAbbreviation(revstr);
|
return resolveAbbreviation(revstr);
|
||||||
|
|
||||||
int dashg = revstr.indexOf("-g");
|
int dashg = revstr.indexOf("-g");
|
||||||
if ((dashg + 4) < revstr.length() && 0 <= dashg
|
if ((dashg + 5) < revstr.length() && 0 <= dashg
|
||||||
&& isHex(revstr.charAt(dashg + 2))
|
&& isHex(revstr.charAt(dashg + 2))
|
||||||
&& isHex(revstr.charAt(dashg + 3))
|
&& isHex(revstr.charAt(dashg + 3))
|
||||||
&& isAllHex(revstr, dashg + 4)) {
|
&& isAllHex(revstr, dashg + 4)) {
|
||||||
|
|
Loading…
Reference in New Issue