Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:43 +0300
committerJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:44 +0300
commit1ae0949a036864de1f5caa7b375b875284d1c69e (patch)
tree800b0226c23ed0596f38507d4d4ad8818307a94e /t/t4013-diff-various.sh
parentc23cd78e8127a2f80cc0357994209bc1bb81a4fe (diff)
parent296d4a94e7231a1d57356889f51bff57a1a3c5a1 (diff)
Merge branch 'mk/diff-ignore-regex'
"git diff" family of commands learned the "-I<regex>" option to ignore hunks whose changed lines all match the given pattern. * mk/diff-ignore-regex: diff: add -I<regex> that ignores matching changes merge-base, xdiff: zero out xpparam_t structures
Diffstat (limited to 't/t4013-diff-various.sh')
-rwxr-xr-xt/t4013-diff-various.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 5c7b0122b4..f72d456d3b 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -6,6 +6,7 @@
test_description='Various diff formatting options'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/diff-lib.sh
test_expect_success setup '
@@ -333,6 +334,7 @@ log -SF master --max-count=2
log -GF master
log -GF -p master
log -GF -p --pickaxe-all master
+log -IA -IB -I1 -I2 -p master
log --decorate --all
log --decorate=full --all
@@ -473,4 +475,43 @@ test_expect_success 'diff-tree --stdin with log formatting' '
test_cmp expect actual
'
+test_expect_success 'diff -I<regex>: setup' '
+ git checkout master &&
+ test_seq 50 >file0 &&
+ git commit -m "Set up -I<regex> test file" file0 &&
+ test_seq 50 | sed -e "s/13/ten and three/" -e "/7\$/d" >file0 &&
+ echo >>file0
+'
+test_expect_success 'diff -I<regex>' '
+ git diff --ignore-blank-lines -I"ten.*e" -I"^[124-9]" >actual &&
+ cat >expect <<-\EOF &&
+ diff --git a/file0 b/file0
+ --- a/file0
+ +++ b/file0
+ @@ -34,7 +31,6 @@
+ 34
+ 35
+ 36
+ -37
+ 38
+ 39
+ 40
+ EOF
+ compare_diff_patch expect actual
+'
+
+test_expect_success 'diff -I<regex> --stat' '
+ git diff --stat --ignore-blank-lines -I"ten.*e" -I"^[124-9]" >actual &&
+ cat >expect <<-\EOF &&
+ file0 | 1 -
+ 1 file changed, 1 deletion(-)
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'diff -I<regex>: detect malformed regex' '
+ test_expect_code 129 git diff --ignore-matching-lines="^[124-9" 2>error &&
+ test_i18ngrep "invalid regex given to -I: " error
+'
+
test_done