Browse Source

Fix the ls-remote command when there is no local repo

Bug: 436695
Change-Id: I567f9a8e355c7624efa3efc9bac4f3b9015afa97
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-3.5
Robin Rosenberg 11 years ago committed by Matthias Sohn
parent
commit
bbe99d5b39
  1. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  2. 4
      org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java

@ -80,6 +80,11 @@ class LsRemote extends TextBuiltin {
} }
} }
@Override
protected boolean requiresRepository() {
return false;
}
private void show(final AnyObjectId id, final String name) private void show(final AnyObjectId id, final String name)
throws IOException { throws IOException {
outw.print(id.name()); outw.print(id.name());

4
org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java

@ -311,10 +311,14 @@ public abstract class Transport {
public static Transport open(final Repository local, final String remote, public static Transport open(final Repository local, final String remote,
final Operation op) throws NotSupportedException, final Operation op) throws NotSupportedException,
URISyntaxException, TransportException { URISyntaxException, TransportException {
if (local != null) {
final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote); final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
if (doesNotExist(cfg)) if (doesNotExist(cfg))
return open(local, new URIish(remote), null); return open(local, new URIish(remote), null);
return open(local, cfg, op); return open(local, cfg, op);
} else
return open(new URIish(remote));
} }
/** /**

Loading…
Cancel
Save