From 3bb0923f06c55ea44569f547cefa9e1a59069ff2 Mon Sep 17 00:00:00 2001 From: Paul-Sebastian Ungureanu Date: Thu, 22 Mar 2018 20:43:51 +0200 Subject: parse-options: do not show usage upon invalid option value Usually, the usage should be shown only if the user does not know what options are available. If the user specifies an invalid value, the user is already aware of the available options. In this case, there is no point in displaying the usage anymore. This patch applies to "git tag --contains", "git branch --contains", "git branch --points-at", "git for-each-ref --contains" and many more. Signed-off-by: Paul-Sebastian Ungureanu Signed-off-by: Junio C Hamano --- builtin/update-index.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin/update-index.c') diff --git a/builtin/update-index.c b/builtin/update-index.c index 58d1c2d282..34adf55a71 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1059,6 +1059,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) break; switch (parseopt_state) { case PARSE_OPT_HELP: + case PARSE_OPT_ERROR: exit(129); case PARSE_OPT_NON_OPTION: case PARSE_OPT_DONE: -- cgit v1.2.3