diff options
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties | 1 | ||||
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java | 15 |
2 files changed, 16 insertions, 0 deletions
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 c116437c64..6112a272e4 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 @@ -256,6 +256,7 @@ usage_LsFiles=Show information about files in the index and the working tree 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_lsRemoteSymref=In addition to the object pointed at, show the underlying ref pointed at when showing a symbolic ref. usage_LsTree=List the contents of a tree object usage_MakeCacheTree=Show the current cache tree structure usage_Match=Only consider tags matching the given glob(7) pattern or patterns, excluding the "refs/tags/" prefix. 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 36812c03a4..055b48a157 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 @@ -34,6 +34,9 @@ class LsRemote extends TextBuiltin { @Option(name = "--timeout", metaVar = "metaVar_service", usage = "usage_abortConnectionIfNoActivity") int timeout = -1; + @Option(name = "--symref", usage = "usage_lsRemoteSymref") + private boolean symref; + @Argument(index = 0, metaVar = "metaVar_uriish", required = true) private String remote; @@ -47,6 +50,9 @@ class LsRemote extends TextBuiltin { try { refs.addAll(command.call()); for (Ref r : refs) { + if (symref && r.isSymbolic()) { + show(r.getTarget(), r.getName()); + } show(r.getObjectId(), r.getName()); if (r.getPeeledObjectId() != null) { show(r.getPeeledObjectId(), r.getName() + "^{}"); //$NON-NLS-1$ @@ -70,4 +76,13 @@ class LsRemote extends TextBuiltin { outw.print(name); outw.println(); } + + private void show(Ref ref, String name) + throws IOException { + outw.print("ref: "); + outw.print(ref.getName()); + outw.print('\t'); + outw.print(name); + outw.println(); + } } |