Browse Source

Do not attempt to resolve describe-labels with less than four digits

Change-Id: I21dcd3cca3b41102fd898238d8d640dea25e0caf
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
stable-1.2
Robin Rosenberg 14 years ago
parent
commit
602c869d7a
  1. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java

@ -191,6 +191,10 @@ public class RepositoryResolveTest extends SampleDataRepositoryTestCase {
assertEquals(id, db.resolve("refs/heads/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.setNewObjectId(id);

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

@ -599,7 +599,7 @@ public abstract class Repository {
return resolveAbbreviation(revstr);
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 + 3))
&& isAllHex(revstr, dashg + 4)) {

Loading…
Cancel
Save