diff options
author | Kaloyan Raev <kaloyan.r@zend.com> | 2014-02-24 16:03:51 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-02-26 15:52:25 +0100 |
commit | 44812c02e844c91869c3c43f5187fe23b5426275 (patch) | |
tree | 877762227064df17041aa0227d7f7f163aec6691 /org.eclipse.jgit.pgm/src | |
parent | df4aca21664757adcd8a65145404ffc7f6bb7d12 (diff) | |
download | jgit-44812c02e844c91869c3c43f5187fe23b5426275.tar.gz jgit-44812c02e844c91869c3c43f5187fe23b5426275.zip |
CLI clone command should support --no-checkout
doCheckout() is called only if --no-checkout option is not set.
Bug: 428917
Change-Id: I350bef446dd7a37613b9506aae99679569bd36e1
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 24 |
1 files changed, 15 insertions, 9 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 888f54da2b..d9a877cd67 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 @@ -79,6 +79,9 @@ class Clone extends AbstractFetchCommand { @Option(name = "--branch", aliases = { "-b" }, metaVar = "metaVar_branchName", usage = "usage_checkoutBranchAfterClone") private String branch; + @Option(name = "--no-checkout", aliases = { "-n" }, usage = "usage_noCheckoutAfterClone") + private boolean noCheckout; + @Argument(index = 0, required = true, metaVar = "metaVar_uriish") private String sourceUri; @@ -122,16 +125,19 @@ class Clone extends AbstractFetchCommand { saveRemote(uri); final FetchResult r = runFetch(); - final Ref checkoutRef; - if (branch == null) - checkoutRef = guessHEAD(r); - else { - checkoutRef = r.getAdvertisedRef(Constants.R_HEADS + branch); - if (checkoutRef == null) - throw die(MessageFormat.format(CLIText.get().noSuchRemoteRef, - branch)); + + if (!noCheckout) { + final Ref checkoutRef; + if (branch == null) + checkoutRef = guessHEAD(r); + else { + checkoutRef = r.getAdvertisedRef(Constants.R_HEADS + branch); + if (checkoutRef == null) + throw die(MessageFormat.format( + CLIText.get().noSuchRemoteRef, branch)); + } + doCheckout(checkoutRef); } - doCheckout(checkoutRef); } private void saveRemote(final URIish uri) throws URISyntaxException, |