git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] builtin/checkout.c: show usage with options on missing argument 'branch'

From
Ralf Thielow <ralf.thielow@googlemail.com>
Date
May 5, 2011, 17:18 UTC
Message-ID
<1304615890-12840-1-git-send-email-ralf.thielow@googlemail.com>
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
Message 1 of 1 in “builtin/checkout.c: show usage with options on missing argument 'branch'”
  1. builtin/checkout.c: show usage with options on missing argument 'branch'Ralf Thielow, May 5, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.