summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-02-21 11:16:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-21 23:16:59 (GMT)
commit87649a1674a80a0c66b9c17977e7b54c08dd684a (patch)
treeb59a09ef4626a3f2d33b24f500d37103749b0c40
parent2e75f922f3ee73a1ff9c232c11c82c6006ebeb1d (diff)
downloadgit-87649a1674a80a0c66b9c17977e7b54c08dd684a.zip
git-87649a1674a80a0c66b9c17977e7b54c08dd684a.tar.gz
git-87649a1674a80a0c66b9c17977e7b54c08dd684a.tar.bz2
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>
-rw-r--r--diff.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/diff.c b/diff.c
index 33492e7..a63ee4a 100644
--- a/diff.c
+++ b/diff.c
@@ -5109,6 +5109,21 @@ static void prep_parse_options(struct diff_options *options)
OPT_BIT(0, "minimal", &options->xdl_opts,
N_("produce the smallest possible diff"),
XDF_NEED_MINIMAL),
+ OPT_BIT_F('w', "ignore-all-space", &options->xdl_opts,
+ N_("ignore whitespace when comparing lines"),
+ XDF_IGNORE_WHITESPACE, PARSE_OPT_NONEG),
+ OPT_BIT_F('b', "ignore-space-change", &options->xdl_opts,
+ N_("ignore changes in amount of whitespace"),
+ XDF_IGNORE_WHITESPACE_CHANGE, PARSE_OPT_NONEG),
+ OPT_BIT_F(0, "ignore-space-at-eol", &options->xdl_opts,
+ N_("ignore changes in whitespace at EOL"),
+ XDF_IGNORE_WHITESPACE_AT_EOL, PARSE_OPT_NONEG),
+ OPT_BIT_F(0, "ignore-cr-at-eol", &options->xdl_opts,
+ N_("ignore carrier-return at the end of line"),
+ XDF_IGNORE_CR_AT_EOL, PARSE_OPT_NONEG),
+ OPT_BIT_F(0, "ignore-blank-lines", &options->xdl_opts,
+ N_("ignore changes whose lines are all blank"),
+ XDF_IGNORE_BLANK_LINES, PARSE_OPT_NONEG),
OPT_GROUP(N_("Diff other options")),
OPT_CALLBACK_F(0, "relative", options, N_("<prefix>"),
@@ -5147,17 +5162,7 @@ int diff_opt_parse(struct diff_options *options,
return ac;
/* xdiff options */
- if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
- DIFF_XDL_SET(options, IGNORE_WHITESPACE);
- else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
- DIFF_XDL_SET(options, IGNORE_WHITESPACE_CHANGE);
- else if (!strcmp(arg, "--ignore-space-at-eol"))
- DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);
- else if (!strcmp(arg, "--ignore-cr-at-eol"))
- DIFF_XDL_SET(options, IGNORE_CR_AT_EOL);
- else if (!strcmp(arg, "--ignore-blank-lines"))
- DIFF_XDL_SET(options, IGNORE_BLANK_LINES);
- else if (!strcmp(arg, "--indent-heuristic"))
+ if (!strcmp(arg, "--indent-heuristic"))
DIFF_XDL_SET(options, INDENT_HEURISTIC);
else if (!strcmp(arg, "--no-indent-heuristic"))
DIFF_XDL_CLR(options, INDENT_HEURISTIC);