Skip to content

Commit bf29f07

Browse files
committed
Merge branch 'nd/show-gitcomp-compilation-fix' into maint
Portability fix for a recent update to parse-options API. * nd/show-gitcomp-compilation-fix: parse-options: fix SunCC compiler warning
2 parents 6be6e66 + a92ec7e commit bf29f07

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

builtin/blame.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
850850
case PARSE_OPT_HELP:
851851
case PARSE_OPT_ERROR:
852852
exit(129);
853+
case PARSE_OPT_COMPLETE:
854+
exit(0);
853855
case PARSE_OPT_DONE:
854856
if (ctx.argv[0])
855857
dashdash_pos = ctx.cpidx;

builtin/shortlog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
287287
case PARSE_OPT_HELP:
288288
case PARSE_OPT_ERROR:
289289
exit(129);
290+
case PARSE_OPT_COMPLETE:
291+
exit(0);
290292
case PARSE_OPT_DONE:
291293
goto parse_done;
292294
}

builtin/update-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
10861086
case PARSE_OPT_HELP:
10871087
case PARSE_OPT_ERROR:
10881088
exit(129);
1089+
case PARSE_OPT_COMPLETE:
1090+
exit(0);
10891091
case PARSE_OPT_NON_OPTION:
10901092
case PARSE_OPT_DONE:
10911093
{

parse-options.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int show_gitcomp(struct parse_opt_ctx_t *ctx,
516516
show_negated_gitcomp(original_opts, -1);
517517
show_negated_gitcomp(original_opts, nr_noopts);
518518
fputc('\n', stdout);
519-
exit(0);
519+
return PARSE_OPT_COMPLETE;
520520
}
521521

522522
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,
638638
case PARSE_OPT_HELP:
639639
case PARSE_OPT_ERROR:
640640
exit(129);
641+
case PARSE_OPT_COMPLETE:
642+
exit(0);
641643
case PARSE_OPT_NON_OPTION:
642644
case PARSE_OPT_DONE:
643645
break;

parse-options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ extern int opterror(const struct option *opt, const char *reason, int flags);
208208
/*----- incremental advanced APIs -----*/
209209

210210
enum {
211+
PARSE_OPT_COMPLETE = -2,
211212
PARSE_OPT_HELP = -1,
212213
PARSE_OPT_DONE,
213214
PARSE_OPT_NON_OPTION,

0 commit comments

Comments
 (0)