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 <ungureanupaulsebastian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
38e79b1fda
commit
3bb0923f06
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user