diff-parseopt: convert --ignore-some-changes
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
87649a1674a80a0c66b9c17977e7b54c08dd684a
1 file changed
+16
-11
diff.c
+16
-11
@@ -5109,6 +5109,21 @@ static void prep_parse_options(struct diff_options *options)
5109
OPT_BIT(0, "minimal", &options->xdl_opts,
5110
N_("produce the smallest possible diff"),
5111
XDF_NEED_MINIMAL),
5112
+ OPT_BIT_F('w', "ignore-all-space", &options->xdl_opts,
5113
+ N_("ignore whitespace when comparing lines"),
5114
+ XDF_IGNORE_WHITESPACE, PARSE_OPT_NONEG),
5115
+ OPT_BIT_F('b', "ignore-space-change", &options->xdl_opts,
5116
+ N_("ignore changes in amount of whitespace"),
5117
+ XDF_IGNORE_WHITESPACE_CHANGE, PARSE_OPT_NONEG),
5118
+ OPT_BIT_F(0, "ignore-space-at-eol", &options->xdl_opts,
5119
+ N_("ignore changes in whitespace at EOL"),
5120
+ XDF_IGNORE_WHITESPACE_AT_EOL, PARSE_OPT_NONEG),
5121
+ OPT_BIT_F(0, "ignore-cr-at-eol", &options->xdl_opts,
5122
+ N_("ignore carrier-return at the end of line"),
5123
+ XDF_IGNORE_CR_AT_EOL, PARSE_OPT_NONEG),
5124
+ OPT_BIT_F(0, "ignore-blank-lines", &options->xdl_opts,
5125
+ N_("ignore changes whose lines are all blank"),
5126
+ XDF_IGNORE_BLANK_LINES, PARSE_OPT_NONEG),
5127
5128
OPT_GROUP(N_("Diff other options")),
5129
OPT_CALLBACK_F(0, "relative", options, N_("<prefix>"),
@@ -5147,17 +5162,7 @@ int diff_opt_parse(struct diff_options *options,
5162
return ac;
5163
5164
/* xdiff options */
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);
5154
- else if (!strcmp(arg, "--ignore-space-at-eol"))
5155
- DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);
5156
- else if (!strcmp(arg, "--ignore-cr-at-eol"))
5157
- DIFF_XDL_SET(options, IGNORE_CR_AT_EOL);
5158
- else if (!strcmp(arg, "--ignore-blank-lines"))
5159
- DIFF_XDL_SET(options, IGNORE_BLANK_LINES);
5160
- else if (!strcmp(arg, "--indent-heuristic"))
5165
+ if (!strcmp(arg, "--indent-heuristic"))
5166
DIFF_XDL_SET(options, INDENT_HEURISTIC);
5167
else if (!strcmp(arg, "--no-indent-heuristic"))
5168
DIFF_XDL_CLR(options, INDENT_HEURISTIC);