blob: 78090e6852d5a8362e53414a1b4fc3302a24d874 [file] [log] [blame]
Nguyễn Thái Ngọc Duy540e6942009-08-11 22:43:59 +07001#!/bin/sh
2
3test_description='diff with assume-unchanged entries'
4
Ævar Arnfjörð Bjarmason6ab75ac2022-04-13 22:01:53 +02005TEST_PASSES_SANITIZE_LEAK=true
Nguyễn Thái Ngọc Duy540e6942009-08-11 22:43:59 +07006. ./test-lib.sh
7
8# external diff has been tested in t4020-diff-external.sh
9
10test_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. carlson37ab8eb2019-10-28 00:59:04 +000016 blob=$(git hash-object one) &&
Nguyễn Thái Ngọc Duy540e6942009-08-11 22:43:59 +070017 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
24test_expect_success 'diff-index does not examine assume-unchanged entries' '
brian m. carlson37ab8eb2019-10-28 00:59:04 +000025 git diff-index HEAD^ -- one | grep -q $blob
Nguyễn Thái Ngọc Duy540e6942009-08-11 22:43:59 +070026'
27
28test_expect_success 'diff-files does not examine assume-unchanged entries' '
29 rm one &&
30 test -z "$(git diff-files -- one)"
31'
32
Jeff King53048102014-05-14 18:13:06 -040033test_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 King53048102014-05-14 18:13:06 -040039 git diff-files --find-copies-harder -- exec >actual &&
Ævar Arnfjörð Bjarmasond3c67512018-07-27 17:48:11 +000040 test_must_be_empty actual
Jeff King53048102014-05-14 18:13:06 -040041'
42
Nguyễn Thái Ngọc Duy540e6942009-08-11 22:43:59 +070043test_done