Browse Source

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
stable-5.0
Christian Halstrick 7 years ago
parent
commit
45599ae86d
  1. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryResolveTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

2
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");

2
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;

Loading…
Cancel
Save