提交 735ca208 编写于 作者: J Jeff King 提交者: Junio C Hamano

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 aaf6c447 (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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 0eb8d376
......@@ -4812,7 +4812,7 @@ static int apply_option_parse_whitespace(const struct option *opt,
struct apply_state *state = opt->value;
state->whitespace_option = arg;
if (parse_whitespace_option(state, arg))
exit(1);
return -1;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册