提交 3f4f17b5 编写于 作者: R René Scharfe 提交者: Junio C Hamano

diff: parse ws-error-highlight option more strictly

Check if a matched token is followed by a delimiter before advancing the
pointer arg.  This avoids accepting composite words like "allnew" or
"defaultcontext" and misparsing them as "new" or "context".
Signed-off-by: NRene Scharfe <l.s.r@web.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b8767f79
......@@ -3654,7 +3654,12 @@ static void enable_patch_output(int *fmt) {
static int parse_one_token(const char **arg, const char *token)
{
return skip_prefix(*arg, token, arg) && (!**arg || **arg == ',');
const char *rest;
if (skip_prefix(*arg, token, &rest) && (!*rest || *rest == ',')) {
*arg = rest;
return 1;
}
return 0;
}
static int parse_ws_error_highlight(struct diff_options *opt, const char *arg)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册