diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2022-02-20 18:11:49 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2022-03-06 17:30:01 +0100 |
commit | 8a2c76941729629dce06e2238464e114f2ccc79a (patch) | |
tree | d8b66eb5d0527f34bb7c56b509f5cf65fd8fb9e2 /org.eclipse.jgit.test/tst/org/eclipse/jgit/transport | |
parent | 90df7c123ecac9ae75a189b761a2599d5fba3565 (diff) | |
download | jgit-8a2c76941729629dce06e2238464e114f2ccc79a.tar.gz jgit-8a2c76941729629dce06e2238464e114f2ccc79a.zip |
[push] support the "matching" RefSpecs ":" and "+:"
The implementation of push.default=matching was not correct.
It used the RefSpec "refs/heads/*:refs/heads/*", which would push
_all_ local branches. But "matching" must push only those local
branches for which a remote branch with the same name already exists
at the remote.
This RefSpec can be expanded only once the advertisement from the
remote has been received.
Enhance RefSpec so that ":" and "+:" can be represented. Introduce a
special RemoteRefUpdate for such a RefSpec; it must carry through the
fetch RefSpecs to be able to fill in the remote tracking updates as
needed. Implement the expansion in PushProcess.
Bug: 353405
Change-Id: I54a4bfbb0a6a7d77b9128bf4a9c951d6586c3df4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/transport')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RefSpecTest.java | 14 |
1 files changed, 14 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 5569bca23c..b56308cb72 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 @@ -466,4 +466,18 @@ public class RefSpecTest { assertTrue(a.matchSource("refs/heads/master")); assertNull(a.getDestination()); } + + @Test + public void matching() { + RefSpec a = new RefSpec(":"); + assertTrue(a.isMatching()); + assertFalse(a.isForceUpdate()); + } + + @Test + public void matchingForced() { + RefSpec a = new RefSpec("+:"); + assertTrue(a.isMatching()); + assertTrue(a.isForceUpdate()); + } } |