From 87433261a46db1a9bd012acd7fba868f009ba38f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 14 Dec 2016 10:10:10 -0500 Subject: parse-options: print "fatal:" before usage_msg_opt() Programs may use usage_msg_opt() to print a brief message followed by the program usage, and then exit. The message isn't prefixed at all, though, so it doesn't match our usual error output and is easy to overlook: $ git clone 1 2 3 Too many arguments. usage: git clone [] [--] [] -v, --verbose be more verbose -q, --quiet be more quiet --progress force progress reporting -n, --no-checkout don't create a checkout --bare create a bare repository [...and so on for another 31 lines...] It looks especially bad when the message starts with an option, like: $ git replace -e -e needs exactly one argument usage: git replace [-f] or: git replace [-f] --edit [...etc...] Let's put our usual "fatal:" prefix in front of it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- parse-options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse-options.c b/parse-options.c index 312a85dbd..4fbe924a5 100644 --- a/parse-options.c +++ b/parse-options.c @@ -661,7 +661,7 @@ void NORETURN usage_msg_opt(const char *msg, const char * const *usagestr, const struct option *options) { - fprintf(stderr, "%s\n\n", msg); + fprintf(stderr, "fatal: %s\n\n", msg); usage_with_options(usagestr, options); } -- cgit v1.2.1