diff-parseopt: convert --[no-]minimal
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Feb 21, 2019 at 18:16 UTC
2e75f922f3ee73a1ff9c232c11c82c6006ebeb1d
1 file changed
+6
-5
diff.c
+6
-5
@@ -5105,6 +5105,11 @@ static void prep_parse_options(struct diff_options *options)
5105
OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
5106
N_("use empty blobs as rename source")),
5107
5108
+ OPT_GROUP(N_("Diff algorithm options")),
5109
+ OPT_BIT(0, "minimal", &options->xdl_opts,
5110
+ N_("produce the smallest possible diff"),
5111
+ XDF_NEED_MINIMAL),
5112
+
5113
OPT_GROUP(N_("Diff other options")),
5114
OPT_CALLBACK_F(0, "relative", options, N_("<prefix>"),
5115
N_("when run from subdir, exclude changes outside and show relative paths"),
@@ -5142,11 +5147,7 @@ int diff_opt_parse(struct diff_options *options,
5147
return ac;
5148
5149
/* xdiff options */
5145
- if (!strcmp(arg, "--minimal"))
5146
- DIFF_XDL_SET(options, NEED_MINIMAL);
5147
- else if (!strcmp(arg, "--no-minimal"))
5148
- DIFF_XDL_CLR(options, NEED_MINIMAL);
5149
- else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
5150
+ if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
5151
DIFF_XDL_SET(options, IGNORE_WHITESPACE);
5152
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
5153
DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE);