summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2014-12-22 09:23:24 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2014-12-22 09:23:24 -0500
commitf0bed370a37dc12e4d54bdc14040b667056ca6ea (patch)
tree2f1bf7240b217c623f813cf4d7c1a1c249f961d6
parentd2fe4201ad9b6c0431822ede60f0dd1310483637 (diff)
parent490660a7c61d6226ac52d0e00198dd90a3891115 (diff)
downloadjgit-f0bed370a37dc12e4d54bdc14040b667056ca6ea.tar.gz
jgit-f0bed370a37dc12e4d54bdc14040b667056ca6ea.zip
Merge "[pgm] Add option --heads for ls-remote" into stable-3.6
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/LsRemoteTest.java11
-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, 16 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 695dea831e..f03edb0693 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
@@ -93,4 +93,15 @@ public class LsRemoteTest extends CLIRepositoryTestCase {
"d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/tags/tag3^{}",
"" }, result.toArray());
}
+
+ @Test
+ public void testLsRemoteHeads() throws Exception {
+ final List<String> result = CLIGitCommand.execute(
+ "git ls-remote --heads "
+ + db.getDirectory(), db);
+ assertArrayEquals(new String[] {
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/master",
+ "d0b1ef2b3dea02bb2ca824445c04e6def012c32c refs/heads/test",
+ "" }, 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 bdf05e901a..52a21f7216 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
@@ -203,6 +203,7 @@ usage_Gc=Cleanup unnecessary files and optimize the local repository
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_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 0200d8cfde..096d8528d4 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
@@ -58,6 +58,9 @@ import org.kohsuke.args4j.Option;
@Command(common = true, usage = "usage_LsRemote")
class LsRemote extends TextBuiltin {
+ @Option(name = "--heads", usage = "usage_lsRemoteHeads")
+ private boolean heads;
+
@Option(name = "--timeout", metaVar = "metaVar_service", usage = "usage_abortConnectionIfNoActivity")
int timeout = -1;
@@ -67,7 +70,7 @@ class LsRemote extends TextBuiltin {
@Override
protected void run() throws Exception {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
- .setTimeout(timeout);
+ .setTimeout(timeout).setHeads(heads);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
public int compare(Ref r1, Ref r2) {