Nguyễn Thái Ngọc Duy | 540e694 | 2009-08-11 22:43:59 +0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='diff with assume-unchanged entries' |
| 4 | |
Ævar Arnfjörð Bjarmason | 6ab75ac | 2022-04-13 22:01:53 +0200 | [diff] [blame] | 5 | TEST_PASSES_SANITIZE_LEAK=true |
Nguyễn Thái Ngọc Duy | 540e694 | 2009-08-11 22:43:59 +0700 | [diff] [blame] | 6 | . ./test-lib.sh |
| 7 | |
| 8 | # external diff has been tested in t4020-diff-external.sh |
| 9 | |
| 10 | test_expect_success 'setup' ' |
| 11 | echo zero > zero && |
| 12 | git add zero && |
| 13 | git commit -m zero && |
| 14 | echo one > one && |
| 15 | echo two > two && |
brian m. carlson | 37ab8eb | 2019-10-28 00:59:04 +0000 | [diff] [blame] | 16 | blob=$(git hash-object one) && |
Nguyễn Thái Ngọc Duy | 540e694 | 2009-08-11 22:43:59 +0700 | [diff] [blame] | 17 | git add one two && |
| 18 | git commit -m onetwo && |
| 19 | git update-index --assume-unchanged one && |
| 20 | echo borked >> one && |
| 21 | test "$(git ls-files -v one)" = "h one" |
| 22 | ' |
| 23 | |
| 24 | test_expect_success 'diff-index does not examine assume-unchanged entries' ' |
brian m. carlson | 37ab8eb | 2019-10-28 00:59:04 +0000 | [diff] [blame] | 25 | git diff-index HEAD^ -- one | grep -q $blob |
Nguyễn Thái Ngọc Duy | 540e694 | 2009-08-11 22:43:59 +0700 | [diff] [blame] | 26 | ' |
| 27 | |
| 28 | test_expect_success 'diff-files does not examine assume-unchanged entries' ' |
| 29 | rm one && |
| 30 | test -z "$(git diff-files -- one)" |
| 31 | ' |
| 32 | |
Jeff King | 5304810 | 2014-05-14 18:13:06 -0400 | [diff] [blame] | 33 | test_expect_success POSIXPERM 'find-copies-harder is not confused by mode bits' ' |
| 34 | echo content >exec && |
| 35 | chmod +x exec && |
| 36 | git add exec && |
| 37 | git commit -m exec && |
| 38 | git update-index --assume-unchanged exec && |
Jeff King | 5304810 | 2014-05-14 18:13:06 -0400 | [diff] [blame] | 39 | git diff-files --find-copies-harder -- exec >actual && |
Ævar Arnfjörð Bjarmason | d3c6751 | 2018-07-27 17:48:11 +0000 | [diff] [blame] | 40 | test_must_be_empty actual |
Jeff King | 5304810 | 2014-05-14 18:13:06 -0400 | [diff] [blame] | 41 | ' |
| 42 | |
Nguyễn Thái Ngọc Duy | 540e694 | 2009-08-11 22:43:59 +0700 | [diff] [blame] | 43 | test_done |