summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2014-12-22 09:25:15 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2014-12-22 09:25:15 -0500
commit902541f28b069d7cc43269cb6e58999ad3acf79d (patch)
treeb85addf67dc813dab2f09b1489177075fe9d357f
parentf0bed370a37dc12e4d54bdc14040b667056ca6ea (diff)
parent8812e6f3f60dc6bc86ba57c3e82288780f735f6b (diff)
downloadjgit-902541f28b069d7cc43269cb6e58999ad3acf79d.tar.gz
jgit-902541f28b069d7cc43269cb6e58999ad3acf79d.zip
Merge "[pgm] Add option --tags for ls-remote" into stable-3.6
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java31
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java5
3 files changed, 36 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 f03edb0693..ba6b771de5 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
@@ -104,4 +104,35 @@ public class LsRemoteTest extends CLIRepositoryTestCase {
"d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/test",
"" }, result.toArray());
}
+
+ @Test
+ public void testLsRemoteTags() throws Exception {
+ final List<String> result = CLIGitCommand.execute(
+ "git ls-remote --tags " + db.getDirectory(), db);
+ assertArrayEquals(new String[] {
+ "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());
+ }
+
+ @Test
+ public void testLsRemoteHeadsTags() throws Exception {
+ final List<String> result = CLIGitCommand.execute(
+ "git ls-remote --heads --tags " + db.getDirectory(), db);
+ assertArrayEquals(new String[] {
+ "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());
+ }
+
}
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index 52a21f7216..7ed77ee04a 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -204,6 +204,7 @@ usage_Glog=View commit history as a graph
usage_IndexPack=Build pack index file for an existing packed archive
usage_LsRemote=List references in a remote repository
usage_lsRemoteHeads=Show only refs starting with refs/heads
+usage_lsRemoteTags=Show only refs starting with refs/tags
usage_LsTree=List the contents of a tree object
usage_MakeCacheTree=Show the current cache tree structure
usage_MergeBase=Find as good common ancestors as possible for a merge
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
index 096d8528d4..6262ad2469 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
@@ -61,6 +61,9 @@ class LsRemote extends TextBuiltin {
@Option(name = "--heads", usage = "usage_lsRemoteHeads")
private boolean heads;
+ @Option(name = "--tags", usage = "usage_lsRemoteTags", aliases = { "-t" })
+ private boolean tags;
+
@Option(name = "--timeout", metaVar = "metaVar_service", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1;
@@ -70,7 +73,7 @@ class LsRemote extends TextBuiltin {
@Override
protected void run() throws Exception {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
- .setTimeout(timeout).setHeads(heads);
+ .setTimeout(timeout).setHeads(heads).setTags(tags);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
public int compare(Ref r1, Ref r2) {