diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-05-30 10:50:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-30 10:50:44 -0700 |
commit | 20aa7c594fbc2e36476daae2f53d7c020306c62c (patch) | |
tree | 16594455c941e4bc0002e32a624d27a29b0caeed /diff.c | |
parent | aa25c82427ae70aebf3b8f970f2afd54e9a2a8c6 (diff) | |
parent | f7e68a08780e91d7c2f830f33457041407172b96 (diff) | |
download | git-20aa7c594fbc2e36476daae2f53d7c020306c62c.tar.gz |
Merge branch 'nd/diff-parseopt'
A brown-paper-bag bugfix to a change already in 'master'.
* nd/diff-parseopt:
parse-options: check empty value in OPT_INTEGER and OPT_ABBREV
diff-parseopt: restore -U (no argument) behavior
diff-parseopt: correct variable types that are used by parseopt
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -5211,9 +5211,11 @@ static int diff_opt_unified(const struct option *opt, BUG_ON_OPT_NEG(unset); - options->context = strtol(arg, &s, 10); - if (*s) - return error(_("%s expects a numerical value"), "--unified"); + if (arg) { + options->context = strtol(arg, &s, 10); + if (*s) + return error(_("%s expects a numerical value"), "--unified"); + } enable_patch_output(&options->output_format); return 0; @@ -5272,7 +5274,7 @@ static void prep_parse_options(struct diff_options *options) DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT), OPT_CALLBACK_F('U', "unified", options, N_("<n>"), N_("generate diffs with <n> lines context"), - PARSE_OPT_NONEG, diff_opt_unified), + PARSE_OPT_NONEG | PARSE_OPT_OPTARG, diff_opt_unified), OPT_BOOL('W', "function-context", &options->flags.funccontext, N_("generate diffs with <n> lines context")), OPT_BIT_F(0, "raw", &options->output_format, |