Skip to content

Commit 735ca20

Browse files
peffgitster
authored andcommitted
apply: return -1 from option callback instead of calling exit(1)
The option callback for "apply --whitespace" exits with status "1" on error. It makes more sense for it to just return an error to parse-options. That code will exit, too, but it will use status "129" that is customary for option errors. The exit() dates back to aaf6c44 (builtin/apply: make parse_whitespace_option() return -1 instead of die()ing, 2016-08-08). That commit gives no reason why we'd prefer the current exit status (it looks like it was just bumping the "die" up a level in the callstack, but did not go as far as it could have). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0eb8d37 commit 735ca20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4812,7 +4812,7 @@ static int apply_option_parse_whitespace(const struct option *opt,
48124812
struct apply_state *state = opt->value;
48134813
state->whitespace_option = arg;
48144814
if (parse_whitespace_option(state, arg))
4815-
exit(1);
4815+
return -1;
48164816
return 0;
48174817
}
48184818

0 commit comments

Comments
 (0)