diff options
author | Stefan Beller <sbeller@google.com> | 2016-07-21 14:21:57 -0700 |
---|---|---|
committer | Stefan Beller <sbeller@google.com> | 2016-07-25 10:10:06 -0700 |
commit | 1556ca740b75661a2670ddcb581dafced3010bae (patch) | |
tree | f09627ad7abe0476e43349be81400b35dd7af33c /org.eclipse.jgit.test | |
parent | e9e2f7e6b5c075518bb4a744513558956dd099bf (diff) | |
download | jgit-1556ca740b75661a2670ddcb581dafced3010bae.tar.gz jgit-1556ca740b75661a2670ddcb581dafced3010bae.zip |
RefSpec: reject refs ending in '/'
We had a case in Gerrits superproject subscriptions where
'refs/heads/' was configured with the intention to mean 'refs/heads/*'.
The first expression lacks the '*', which is why it is not considered
a wildcard but it was considered valid and so was not found early to be
a typo.
Refs are not allowed to end with '/' anyway, so add a check for that.
Change-Id: I3ffdd9002146382acafb4fbc310a64af4cc1b7a9
Signed-off-by: Stefan Beller <sbeller@google.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java index 4f833509d9..b14b0b3347 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java @@ -409,6 +409,16 @@ public class RefSpecTest { } @Test(expected = IllegalArgumentException.class) + public void invalidWhenSourceEndsWithSlash() { + assertNotNull(new RefSpec("refs/heads/")); + } + + @Test(expected = IllegalArgumentException.class) + public void invalidWhenDestinationEndsWithSlash() { + assertNotNull(new RefSpec("refs/heads/master:refs/heads/")); + } + + @Test(expected = IllegalArgumentException.class) public void invalidWhenSourceOnlyAndWildcard() { assertNotNull(new RefSpec("refs/heads/*")); } |