Merge branch 'nd/show-gitcomp-compilation-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 15 Dec 2018 03:24:33 +0000 (12:24 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 15 Dec 2018 03:24:33 +0000 (12:24 +0900)
Portability fix for a recent update to parse-options API.

* nd/show-gitcomp-compilation-fix:
parse-options: fix SunCC compiler warning

builtin/blame.c
builtin/shortlog.c
builtin/update-index.c
parse-options.c
parse-options.h
index 06a7163ffe269cd43dc783c81ca6ac71b91b3614..6d798f99392e54b4392713846652111d457787bb 100644 (file)
@@ -850,6 +850,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
                case PARSE_OPT_HELP:
                case PARSE_OPT_ERROR:
                        exit(129);
+               case PARSE_OPT_COMPLETE:
+                       exit(0);
                case PARSE_OPT_DONE:
                        if (ctx.argv[0])
                                dashdash_pos = ctx.cpidx;
index 88f88e97b28c24f74aad6ec6cf1c637003f41a85..65cd41392c1c5e256313b10812a39bf4b848ce1b 100644 (file)
@@ -287,6 +287,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
                case PARSE_OPT_HELP:
                case PARSE_OPT_ERROR:
                        exit(129);
+               case PARSE_OPT_COMPLETE:
+                       exit(0);
                case PARSE_OPT_DONE:
                        goto parse_done;
                }
index 31e7cce3013a3b3f358834f24848fc73b67f8e8b..e19da77edcaa024cc2bffc6fa8818c2b1cf0d4b6 100644 (file)
@@ -1086,6 +1086,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                case PARSE_OPT_HELP:
                case PARSE_OPT_ERROR:
                        exit(129);
+               case PARSE_OPT_COMPLETE:
+                       exit(0);
                case PARSE_OPT_NON_OPTION:
                case PARSE_OPT_DONE:
                {
index 3b874a83a0c897845deeec37c1a3b85e0b625050..6932eaff6144bdf9fc8f430f149a73ade00f0d8b 100644 (file)
@@ -516,7 +516,7 @@ static int show_gitcomp(struct parse_opt_ctx_t *ctx,
        show_negated_gitcomp(original_opts, -1);
        show_negated_gitcomp(original_opts, nr_noopts);
        fputc('\n', stdout);
-       exit(0);
+       return PARSE_OPT_COMPLETE;
 }
 
 static int usage_with_options_internal(struct parse_opt_ctx_t *,
@@ -638,6 +638,8 @@ int parse_options(int argc, const char **argv, const char *prefix,
        case PARSE_OPT_HELP:
        case PARSE_OPT_ERROR:
                exit(129);
+       case PARSE_OPT_COMPLETE:
+               exit(0);
        case PARSE_OPT_NON_OPTION:
        case PARSE_OPT_DONE:
                break;
index 6c4fe2016d65f1093400f8f5080085eb244f0026..a650a7d220bd972b10b7e4a30119e9de3b8ba23a 100644 (file)
@@ -208,6 +208,7 @@ extern int opterror(const struct option *opt, const char *reason, int flags);
 /*----- incremental advanced APIs -----*/
 
 enum {
+       PARSE_OPT_COMPLETE = -2,
        PARSE_OPT_HELP = -1,
        PARSE_OPT_DONE,
        PARSE_OPT_NON_OPTION,