3 test_description='applying patch with mode bits'
7 if test "$(git config --bool core.filemode)" = false
9 say 'filemode disabled on the filesystem'
11 test_set_prereq FILEMODE
14 test_expect_success setup '
15 echo original >file &&
18 git commit -m initial &&
20 echo modified >file &&
21 git diff --stat -p >patch-0.txt &&
23 git diff --stat -p >patch-1.txt
26 test_expect_success FILEMODE 'same mode (no index)' '
29 git apply patch-0.txt &&
33 test_expect_success FILEMODE 'same mode (with index)' '
37 git apply --index patch-0.txt &&
42 test_expect_success FILEMODE 'same mode (index only)' '
46 git apply --cached patch-0.txt &&
47 git ls-files -s file | grep "^100755"
50 test_expect_success FILEMODE 'mode update (no index)' '
52 git apply patch-1.txt &&
56 test_expect_success FILEMODE 'mode update (with index)' '
58 git apply --index patch-1.txt &&
63 test_expect_success FILEMODE 'mode update (index only)' '
65 git apply --cached patch-1.txt &&
66 git ls-files -s file | grep "^100755"