Documentation/describe: improve one-line summary
[git.git] / t / t4129-apply-samemode.sh
blobc268298eaf5672c649ca3e4815dc4f43d71efece
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_expect_success FILEMODE 'same mode (no index)' '
20 git reset --hard &&
21 chmod +x file &&
22 git apply patch-0.txt &&
23 test -x file
26 test_expect_success FILEMODE 'same mode (with index)' '
27 git reset --hard &&
28 chmod +x file &&
29 git add file &&
30 git apply --index patch-0.txt &&
31 test -x file &&
32 git diff --exit-code
35 test_expect_success FILEMODE 'same mode (index only)' '
36 git reset --hard &&
37 chmod +x file &&
38 git add file &&
39 git apply --cached patch-0.txt &&
40 git ls-files -s file | grep "^100755"
43 test_expect_success FILEMODE 'mode update (no index)' '
44 git reset --hard &&
45 git apply patch-1.txt &&
46 test -x file
49 test_expect_success FILEMODE 'mode update (with index)' '
50 git reset --hard &&
51 git apply --index patch-1.txt &&
52 test -x file &&
53 git diff --exit-code
56 test_expect_success FILEMODE 'mode update (index only)' '
57 git reset --hard &&
58 git apply --cached patch-1.txt &&
59 git ls-files -s file | grep "^100755"
62 test_done