summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/tst/org/eclipse
diff options
context:
space:
mode:
authorLee Worrall <worrall.la@gmail.com>2020-10-10 11:31:19 +0800
committerThomas Wolf <thomas.wolf@paranor.ch>2020-11-26 21:14:08 +0100
commit9ebbfe93bb3ba0ea170d330fe227f1d8182d7d64 (patch)
tree52d2401beac6b58d2eb485cd9aebe7958d3469b2 /org.eclipse.jgit.pgm.test/tst/org/eclipse
parentdfa29458e7b187b45e9fb48791ddb71ffac5ad93 (diff)
downloadjgit-9ebbfe93bb3ba0ea170d330fe227f1d8182d7d64.tar.gz
jgit-9ebbfe93bb3ba0ea170d330fe227f1d8182d7d64.zip
Add support for reading symrefs from pack capabilities
A SymbolicRef is added to the advertised refs for any symref in capabilities whose target is an advertised ref; this may replace an existing entry, such as HEAD. When cloning, if any advertised HEAD is symbolic then use the target rather than looking for an advertised ref with a matching objectId. Add --symref option to LsRemote command. Bug: 514052 Change-Id: Idfb48e6f6e8dcfe57a6896883fe6d84d533aa9d0 Signed-off-by: Lee Worrall <worrall.la@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java
index 4ecaeb604a..46eec7436e 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java
@@ -33,7 +33,7 @@ public class LsRemoteTest extends CLIRepositoryTestCase {
git.add().addFilepattern("Test.txt").call();
git.commit().setMessage("Initial commit").call();
- // create a master branch and switch to it
+ // create a test branch and switch to it
git.branchCreate().setName("test").call();
RefUpdate rup = db.updateRef(Constants.HEAD);
rup.link("refs/heads/test");
@@ -104,4 +104,22 @@ public class LsRemoteTest extends CLIRepositoryTestCase {
"" }, result.toArray());
}
+ @Test
+ public void testLsRemoteSymRefs() throws Exception {
+ final List<String> result = CLIGitCommand.execute(
+ "git ls-remote --symref " + shellQuote(db.getDirectory()), db);
+ assertArrayEquals(new String[] {
+ "ref: refs/heads/test HEAD",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c HEAD",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/master",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/test",
+ "efc02078d83a5226986ae917323acec7e1e8b7cb refs/tags/tag1",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/tags/tag1^{}",
+ "4e4b837e0fd4ba83c003678b03592dc1509a4115 refs/tags/tag2",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/tags/tag2^{}",
+ "489384bf8ace47522fe32093d2ceb85b65a6cbb1 refs/tags/tag3",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/tags/tag3^{}",
+ "" }, result.toArray());
+ }
+
}