summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/diff-options.txt1
-rw-r--r--diff.c2
-rw-r--r--revision.c6
-rw-r--r--t/lib-diff-alternative.sh3
4 files changed, 9 insertions, 3 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 791e07feaf..9ed78c9962 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -404,6 +404,7 @@ endif::git-format-patch[]
differences even if one line has whitespace where the other
line has none.
+-i::
--ignore-case::
Ignore changes in case only; only ASCII alphabet is supported for
now.
diff --git a/diff.c b/diff.c
index d7604b7195..9d1584e175 100644
--- a/diff.c
+++ b/diff.c
@@ -3399,7 +3399,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
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-case"))
+ else if (!strcmp(arg, "--ignore-case") || !strcmp(arg, "-i"))
DIFF_XDL_SET(options, IGNORE_CASE);
else if (!strcmp(arg, "--patience"))
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
diff --git a/revision.c b/revision.c
index 8764dde381..f1a13548e2 100644
--- a/revision.c
+++ b/revision.c
@@ -13,6 +13,7 @@
#include "decorate.h"
#include "log-tree.h"
#include "string-list.h"
+#include "xdiff-interface.h"
volatile show_early_output_fn_t show_early_output;
@@ -1557,7 +1558,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
return argcount;
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
revs->grep_filter.regflags |= REG_EXTENDED;
- } else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
+ } else if (!strcmp(arg, "-i")) {
+ DIFF_XDL_SET(&revs->diffopt, IGNORE_CASE);
+ revs->grep_filter.regflags |= REG_ICASE;
+ } else if (!strcmp(arg, "--regexp-ignore-case")) {
revs->grep_filter.regflags |= REG_ICASE;
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
revs->grep_filter.fixed = 1;
diff --git a/t/lib-diff-alternative.sh b/t/lib-diff-alternative.sh
index 45c665e90d..81609f8dcd 100644
--- a/t/lib-diff-alternative.sh
+++ b/t/lib-diff-alternative.sh
@@ -175,9 +175,10 @@ test_diff_ignore () {
echo " A quick brownfox" >test-w
echo "A quick brown fox " >test--ignore-space-at-eol
echo "A Quick Brown Fox" >test--ignore-case
+ echo "A Quick Brown FoX" >test-i
echo "A Quick Brown Fox" >test--ignore-case-b
echo "A quick brown fox jumps" >test
- cases="-b -w --ignore-space-at-eol --ignore-case"
+ cases="-b -w --ignore-space-at-eol --ignore-case -i"
if test -z "$STRATEGY"
then