t4129: skip tests if core.filemode = false
[4msysgit-hv.git] / t / t4129-apply-samemode.sh
bloba74101abba3ae23658e02db3123a09d595ee3c15
1 #!/bin/sh
3 test_description='applying patch with mode bits'
5 . ./test-lib.sh
7 test_expect_success setup '
8 echo original >file &&
9 git add file &&
10 test_tick &&
11 git commit -m initial &&
12 git tag initial &&
13 echo modified >file &&
14 git diff --stat -p >patch-0.txt &&
15 chmod +x file &&
16 git diff --stat -p >patch-1.txt
19 test "$(git config --bool core.filemode)" = false &&
20 say "executable bit not honored - skipping" &&
21 test_done &&
22 exit
24 test_expect_success 'same mode (no index)' '
25 git reset --hard &&
26 chmod +x file &&
27 git apply patch-0.txt &&
28 test -x file
31 test_expect_success 'same mode (with index)' '
32 git reset --hard &&
33 chmod +x file &&
34 git add file &&
35 git apply --index patch-0.txt &&
36 test -x file &&
37 git diff --exit-code
40 test_expect_success 'same mode (index only)' '
41 git reset --hard &&
42 chmod +x file &&
43 git add file &&
44 git apply --cached patch-0.txt &&
45 git ls-files -s file | grep "^100755"
48 test_expect_success 'mode update (no index)' '
49 git reset --hard &&
50 git apply patch-1.txt &&
51 test -x file
54 test_expect_success 'mode update (with index)' '
55 git reset --hard &&
56 git apply --index patch-1.txt &&
57 test -x file &&
58 git diff --exit-code
61 test_expect_success 'mode update (index only)' '
62 git reset --hard &&
63 git apply --cached patch-1.txt &&
64 git ls-files -s file | grep "^100755"
67 test_done