summaryrefslogtreecommitdiff
path: root/git-difftool--helper.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-05-29 09:11:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-29 18:04:33 (GMT)
commitf7e68a08780e91d7c2f830f33457041407172b96 (patch)
treeb157b6f56ef18c90bb56f543d196320e03cfde85 /git-difftool--helper.sh
parent8ef05193bcdda6a28cd41fa3ecd8f356061d49e0 (diff)
downloadgit-f7e68a08780e91d7c2f830f33457041407172b96.zip
git-f7e68a08780e91d7c2f830f33457041407172b96.tar.gz
git-f7e68a08780e91d7c2f830f33457041407172b96.tar.bz2
parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
When parsing the argument for OPT_INTEGER and OPT_ABBREV, we check if we can parse the entire argument to a number with "if (*s)". There is one missing check: if "arg" is empty to begin with, we fail to notice. This could happen with long option by writing like git diff --inter-hunk-context= blah blah Before 16ed6c97cc (diff-parseopt: convert --inter-hunk-context, 2019-03-24), --inter-hunk-context is handled by a custom parser opt_arg() and does detect this correctly. This restores the bahvior for --inter-hunk-context and make sure all other integer options are handled the same (sane) way. For OPT_ABBREV this is new behavior. But it makes it consistent with the rest. PS. OPT_MAGNITUDE has similar code but git_parse_ulong() does detect empty "arg". So it's good to go. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-difftool--helper.sh')
0 files changed, 0 insertions, 0 deletions