summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorPaul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>2018-03-22 18:43:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-22 19:10:08 (GMT)
commit3bb0923f06c55ea44569f547cefa9e1a59069ff2 (patch)
tree9667154be2d13f516298897c4b132191db38b6f4 /builtin
parent38e79b1fdab9244e1727d0698afcf3bb8956c0a4 (diff)
downloadgit-3bb0923f06c55ea44569f547cefa9e1a59069ff2.zip
git-3bb0923f06c55ea44569f547cefa9e1a59069ff2.tar.gz
git-3bb0923f06c55ea44569f547cefa9e1a59069ff2.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/blame.c1
-rw-r--r--builtin/shortlog.c1
-rw-r--r--builtin/update-index.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 005f55a..9803ddc 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -720,6 +720,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
for (;;) {
switch (parse_options_step(&ctx, options, blame_opt_usage)) {
case PARSE_OPT_HELP:
+ case PARSE_OPT_ERROR:
exit(129);
case PARSE_OPT_DONE:
if (ctx.argv[0])
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index e29875b..be4df6a 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -283,6 +283,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
for (;;) {
switch (parse_options_step(&ctx, options, shortlog_usage)) {
case PARSE_OPT_HELP:
+ case PARSE_OPT_ERROR:
exit(129);
case PARSE_OPT_DONE:
goto parse_done;
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 58d1c2d..34adf55 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: