diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2021-01-24 00:17:13 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-02-22 23:11:44 +0100 |
commit | 64cb7148ac64855feb7f7649d1d168d7c6d37860 (patch) | |
tree | 1fdf66e54abe9ce87d65247c1918c5ad8db5cb56 /org.eclipse.jgit.pgm | |
parent | 704ccdc096e4f5cf2670c5c58eaf19fe1fdf4df3 (diff) | |
download | jgit-64cb7148ac64855feb7f7649d1d168d7c6d37860.tar.gz jgit-64cb7148ac64855feb7f7649d1d168d7c6d37860.zip |
Fail clone if initial branch doesn't exist in remote repository
jgit clone --branch foo <url>
did not fail if the remote branch "foo" didn't exist in the remote
repository being cloned.
Bug: 546580
Change-Id: I55648ad3a39da4a5711dfa8e6d6682bb8190a6d6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index fe94b03724..f28915d3fa 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -18,6 +18,7 @@ import java.util.Collection; import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.TransportException; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.TextProgressMonitor; @@ -110,6 +111,8 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback { db = command.call().getRepository(); if (msgs && db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); + } catch (TransportException e) { + throw die(e.getMessage(), e); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri), e); |