Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-01-27 03:35:32 +0300
committerJunio C Hamano <gitster@pobox.com>2019-01-28 03:28:18 +0300
commitcc013c224cfc73cf7d29ce4d336749f00c3bf1c7 (patch)
tree91602dc342cec24e2656d998f82d90db9aa0f4d5 /diff.c
parent4a2884783949d1791ee5d720d8440d5536ebdc91 (diff)
diff.c: convert -u|-p|--patch
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 'diff.c')
-rw-r--r--diff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 80b4af23d7..a4a40e4aa8 100644
--- a/diff.c
+++ b/diff.c
@@ -4870,6 +4870,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()
};
@@ -4898,8 +4905,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;