mingw: implement getppid
[git/kusma.git] / t / t4129-apply-samemode.sh
blobfc7af0493102f12438d59ac5ed6e3e96eda8c841
1 #!/bin/sh
3 test_description='applying patch with mode bits'
5 . ./test-lib.sh
7 if test "$(git config --bool core.filemode)" = false
8 then
9 say 'filemode disabled on the filesystem'
10 else
11 test_set_prereq FILEMODE
14 test_expect_success setup '
15 echo original >file &&
16 git add file &&
17 test_tick &&
18 git commit -m initial &&
19 git tag initial &&
20 echo modified >file &&
21 git diff --stat -p >patch-0.txt &&
22 chmod +x file &&
23 git diff --stat -p >patch-1.txt
26 test_expect_success FILEMODE 'same mode (no index)' '
27 git reset --hard &&
28 chmod +x file &&
29 git apply patch-0.txt &&
30 test -x file
33 test_expect_success FILEMODE 'same mode (with index)' '
34 git reset --hard &&
35 chmod +x file &&
36 git add file &&
37 git apply --index patch-0.txt &&
38 test -x file &&
39 git diff --exit-code
42 test_expect_success FILEMODE 'same mode (index only)' '
43 git reset --hard &&
44 chmod +x file &&
45 git add file &&
46 git apply --cached patch-0.txt &&
47 git ls-files -s file | grep "^100755"
50 test_expect_success FILEMODE 'mode update (no index)' '
51 git reset --hard &&
52 git apply patch-1.txt &&
53 test -x file
56 test_expect_success FILEMODE 'mode update (with index)' '
57 git reset --hard &&
58 git apply --index patch-1.txt &&
59 test -x file &&
60 git diff --exit-code
63 test_expect_success FILEMODE 'mode update (index only)' '
64 git reset --hard &&
65 git apply --cached patch-1.txt &&
66 git ls-files -s file | grep "^100755"
69 test_done