diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java index 1d2a4e9ab..05b78ea19 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java @@ -324,6 +324,8 @@ public class RepositoryResolveTest extends SampleDataRepositoryTestCase { assertFalse(Repository.isValidRefName("x/a\\b")); assertFalse(Repository.isValidRefName("x/a\u0000")); + db.resolve("x/a@"); + assertUnparseable("."); assertUnparseable("x@{3"); assertUnparseable("x[b"); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index c43037ea0..3d85ee4e4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -686,6 +686,8 @@ public abstract class Repository implements AutoCloseable { case '@': if (rev != null) throw new RevisionSyntaxException(revstr); + if (i + 1 == revChars.length) + continue; if (i + 1 < revChars.length && revChars[i + 1] != '{') continue; int m;