]>
Commit | Line | Data |
---|---|---|
1f7903a3 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='applying patch with mode bits' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
872f349e JS |
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 | |
12 | fi | |
13 | ||
1f7903a3 JH |
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 | |
24 | ' | |
25 | ||
872f349e | 26 | test_expect_success FILEMODE 'same mode (no index)' ' |
1f7903a3 JH |
27 | git reset --hard && |
28 | chmod +x file && | |
29 | git apply patch-0.txt && | |
30 | test -x file | |
31 | ' | |
32 | ||
872f349e | 33 | test_expect_success FILEMODE 'same mode (with index)' ' |
1f7903a3 JH |
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 | |
40 | ' | |
41 | ||
872f349e | 42 | test_expect_success FILEMODE 'same mode (index only)' ' |
1f7903a3 JH |
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" | |
48 | ' | |
49 | ||
872f349e | 50 | test_expect_success FILEMODE 'mode update (no index)' ' |
1f7903a3 JH |
51 | git reset --hard && |
52 | git apply patch-1.txt && | |
53 | test -x file | |
54 | ' | |
55 | ||
872f349e | 56 | test_expect_success FILEMODE 'mode update (with index)' ' |
1f7903a3 JH |
57 | git reset --hard && |
58 | git apply --index patch-1.txt && | |
59 | test -x file && | |
60 | git diff --exit-code | |
61 | ' | |
62 | ||
872f349e | 63 | test_expect_success FILEMODE 'mode update (index only)' ' |
1f7903a3 JH |
64 | git reset --hard && |
65 | git apply --cached patch-1.txt && | |
66 | git ls-files -s file | grep "^100755" | |
67 | ' | |
68 | ||
69 | test_done |