mirror of
https://github.com/git/git
synced 2024-07-05 00:58:49 +00:00
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>
This commit is contained in:
parent
4a28847839
commit
cc013c224c
10
diff.c
10
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)
|
static void prep_parse_options(struct diff_options *options)
|
||||||
{
|
{
|
||||||
struct option parseopts[] = {
|
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()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4898,8 +4905,7 @@ int diff_opt_parse(struct diff_options *options,
|
||||||
return ac;
|
return ac;
|
||||||
|
|
||||||
/* Output format options */
|
/* Output format options */
|
||||||
if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch")
|
if (opt_arg(arg, 'U', "unified", &options->context))
|
||||||
|| opt_arg(arg, 'U', "unified", &options->context))
|
|
||||||
enable_patch_output(&options->output_format);
|
enable_patch_output(&options->output_format);
|
||||||
else if (!strcmp(arg, "--raw"))
|
else if (!strcmp(arg, "--raw"))
|
||||||
options->output_format |= DIFF_FORMAT_RAW;
|
options->output_format |= DIFF_FORMAT_RAW;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user