]> source.dussan.org Git - jgit.git/commitdiff
Fix the ls-remote command when there is no local repo 93/32993/1
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 6 Jun 2014 19:18:16 +0000 (21:18 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 6 Sep 2014 23:10:51 +0000 (01:10 +0200)
Bug: 436695
Change-Id: I567f9a8e355c7624efa3efc9bac4f3b9015afa97
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java

index 1842b725e9f53c8d81659e7e9a04018fdab96584..93fcd66c5547c5e93f8803f6f6f7b3722dfe0290 100644 (file)
@@ -80,6 +80,11 @@ class LsRemote extends TextBuiltin {
                }
        }
 
+       @Override
+       protected boolean requiresRepository() {
+               return false;
+       }
+
        private void show(final AnyObjectId id, final String name)
                        throws IOException {
                outw.print(id.name());
index 837bd58d82bb0d2ff2b79a2014db32dcaaac45b1..3ad1db2d49f4fe85780805967fa84f6145c42598 100644 (file)
@@ -311,10 +311,14 @@ public abstract class Transport {
        public static Transport open(final Repository local, final String remote,
                        final Operation op) throws NotSupportedException,
                        URISyntaxException, TransportException {
-               final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
-               if (doesNotExist(cfg))
-                       return open(local, new URIish(remote), null);
-               return open(local, cfg, op);
+               if (local != null) {
+                       final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
+                       if (doesNotExist(cfg))
+                               return open(local, new URIish(remote), null);
+                       return open(local, cfg, op);
+               } else
+                       return open(new URIish(remote));
+
        }
 
        /**