diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-10-17 11:40:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-17 11:40:15 -0700 |
| commit | 1e0a3e8f8f9e160b21fbe6f3f11a11dbed15fb4e (patch) | |
| tree | f72301557649cd895d16b15bce21ef6b47fb36ca /t | |
| parent | Git 2.51 (diff) | |
| parent | diff: ensure consistent diff behavior with ignore options (diff) | |
| download | git-1e0a3e8f8f9e160b21fbe6f3f11a11dbed15fb4e.tar.gz git-1e0a3e8f8f9e160b21fbe6f3f11a11dbed15fb4e.zip | |
Merge branch 'ly/diff-name-only-with-diff-from-content' into jk/diff-from-contents-fix
* ly/diff-name-only-with-diff-from-content:
diff: ensure consistent diff behavior with ignore options
Diffstat (limited to 't')
| -rwxr-xr-x | t/t4013-diff-various.sh | 13 | ||||
| -rwxr-xr-x | t/t4015-diff-whitespace.sh | 8 |
2 files changed, 15 insertions, 6 deletions
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 8ebd170451..cfeec239e0 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -648,6 +648,19 @@ test_expect_success 'diff -I<regex>: detect malformed regex' ' test_grep "invalid regex given to -I: " error ' +test_expect_success 'diff -I<regex>: ignore matching file' ' + test_when_finished "git rm -f file1" && + test_seq 50 >file1 && + git add file1 && + test_seq 50 | sed -e "s/13/ten and three/" -e "s/^[124-9].*/& /" >file1 && + + : >actual && + git diff --raw --ignore-blank-lines -I"ten.*e" -I"^[124-9]" >>actual && + git diff --name-only --ignore-blank-lines -I"ten.*e" -I"^[124-9]" >>actual && + git diff --name-status --ignore-blank-lines -I"ten.*e" -I"^[124-9]" >>actual && + test_grep ! "file1" actual +' + # check_prefix <patch> <src> <dst> # check only lines with paths to avoid dependency on exact oid/contents check_prefix () { diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index 52e3e476ff..9de7f73f42 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -11,12 +11,8 @@ test_description='Test special whitespace in diff engine. . "$TEST_DIRECTORY"/lib-diff.sh for opt_res in --patch --quiet -s --stat --shortstat --dirstat=lines \ - --raw! --name-only! --name-status! + --raw --name-only --name-status do - opts=${opt_res%!} expect_failure= - test "$opts" = "$opt_res" || - expect_failure="test_expect_code 1" - test_expect_success "status with $opts (different)" ' echo foo >x && git add x && @@ -43,7 +39,7 @@ do echo foo >x && git add x && echo " foo" >x && - $expect_failure git diff -w $opts --exit-code x + git diff -w $opts --exit-code x ' done |
