git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Thielow <ralf.thielow@googlemail.com>
To: git@vger.kernel.org
Cc: Ralf Thielow <ralf.thielow@googlemail.com>
Subject: [PATCH v2] builtin/checkout.c: show usage with options on missing argument 'branch'
Date: Thu,  5 May 2011 19:18:10 +0200	[thread overview]
Message-ID: <1304615890-12840-1-git-send-email-ralf.thielow@googlemail.com> (raw)

Show the usage with options for 'checkout' command on missing argument 'branch'.

Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com>
---
 builtin/checkout.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 38632fc..4aa613a 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1086,5 +1086,10 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 	if (opts.writeout_stage)
 		die(_("--ours/--theirs is incompatible with switching branches."));
 
+	if (new.name == NULL) {
+		usage_with_options(checkout_usage, options);
+		return 1;
+	}
+
 	return switch_branches(&opts, &new);
 }
-- 
1.7.5.1

                 reply	other threads:[~2011-05-05 17:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304615890-12840-1-git-send-email-ralf.thielow@googlemail.com \
    --to=ralf.thielow@googlemail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).