From: Nguyễn Thái Ngọc Duy Date: Thu, 17 Jan 2019 13:05:11 GMT Subject: [PATCH 12/76] diff.c: convert -u|-p|--patch Message-ID: <20190117130615.18732-13-pclouds@gmail.com> In-Reply-To: <20190117130615.18732-1-pclouds@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy --- diff.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 60f46052a4..7b78af623b 100644 --- a/diff.c +++ b/diff.c @@ -4868,6 +4868,13 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg) static void prep_parse_options(struct diff_options *options) { struct option parseopts[] = { + OPT_GROUP(N_("Diff output format options")), + OPT_BITOP('p', "patch", &options->output_format, + N_("generate patch"), + DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT), + OPT_BITOP('u', NULL, &options->output_format, + N_("generate patch"), + DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT), OPT_END() }; @@ -4896,8 +4903,7 @@ int diff_opt_parse(struct diff_options *options, return ac; /* Output format options */ - if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch") - || opt_arg(arg, 'U', "unified", &options->context)) + if (opt_arg(arg, 'U', "unified", &options->context)) enable_patch_output(&options->output_format); else if (!strcmp(arg, "--raw")) options->output_format |= DIFF_FORMAT_RAW; -- 2.20.0.482.g66447595a7