diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2018-04-12 08:39:29 +0200 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2018-04-12 09:37:42 +0200 |
commit | 45599ae86d33d2a681acb8723e01c9b42e4fd335 (patch) | |
tree | 0f45e2a1b2177f0de22d17f49f3967177b935c1c | |
parent | aaf4b355574f1d34c767b3de8c1686f08e849cb3 (diff) | |
download | jgit-45599ae86d33d2a681acb8723e01c9b42e4fd335.tar.gz jgit-45599ae86d33d2a681acb8723e01c9b42e4fd335.zip |
Allow '@' as last character of ref
Previously @ was allowed e.g. in branch names, but not as the last
character. The case that @ is the last character was not handled.
Change-Id: Ic33870b22236f7a5ec7b54007f1b0cefd9354bfb
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 2 |
2 files changed, 4 insertions, 0 deletions
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 1d2a4e9ab7..05b78ea195 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 c43037ea0e..3d85ee4e47 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; |