Skip to content

Commit cc013c2

Browse files
pcloudsgitster
authored andcommitted
diff.c: convert -u|-p|--patch
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4a28847 commit cc013c2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

diff.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,6 +4870,13 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg)
48704870
static void prep_parse_options(struct diff_options *options)
48714871
{
48724872
struct option parseopts[] = {
4873+
OPT_GROUP(N_("Diff output format options")),
4874+
OPT_BITOP('p', "patch", &options->output_format,
4875+
N_("generate patch"),
4876+
DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT),
4877+
OPT_BITOP('u', NULL, &options->output_format,
4878+
N_("generate patch"),
4879+
DIFF_FORMAT_PATCH, DIFF_FORMAT_NO_OUTPUT),
48734880
OPT_END()
48744881
};
48754882

@@ -4898,8 +4905,7 @@ int diff_opt_parse(struct diff_options *options,
48984905
return ac;
48994906

49004907
/* Output format options */
4901-
if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch")
4902-
|| opt_arg(arg, 'U', "unified", &options->context))
4908+
if (opt_arg(arg, 'U', "unified", &options->context))
49034909
enable_patch_output(&options->output_format);
49044910
else if (!strcmp(arg, "--raw"))
49054911
options->output_format |= DIFF_FORMAT_RAW;

0 commit comments

Comments
 (0)