]>
Commit | Line | Data |
---|---|---|
1f7903a3 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='applying patch with mode bits' | |
4 | ||
5 | . ./test-lib.sh | |
535d9742 | 6 | . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh |
872f349e | 7 | |
1f7903a3 JH |
8 | test_expect_success setup ' |
9 | echo original >file && | |
10 | git add file && | |
11 | test_tick && | |
12 | git commit -m initial && | |
13 | git tag initial && | |
14 | echo modified >file && | |
15 | git diff --stat -p >patch-0.txt && | |
16 | chmod +x file && | |
17 | git diff --stat -p >patch-1.txt | |
18 | ' | |
19 | ||
872f349e | 20 | test_expect_success FILEMODE 'same mode (no index)' ' |
1f7903a3 JH |
21 | git reset --hard && |
22 | chmod +x file && | |
23 | git apply patch-0.txt && | |
24 | test -x file | |
25 | ' | |
26 | ||
872f349e | 27 | test_expect_success FILEMODE 'same mode (with index)' ' |
1f7903a3 JH |
28 | git reset --hard && |
29 | chmod +x file && | |
30 | git add file && | |
31 | git apply --index patch-0.txt && | |
32 | test -x file && | |
33 | git diff --exit-code | |
34 | ' | |
35 | ||
872f349e | 36 | test_expect_success FILEMODE 'same mode (index only)' ' |
1f7903a3 JH |
37 | git reset --hard && |
38 | chmod +x file && | |
39 | git add file && | |
40 | git apply --cached patch-0.txt && | |
41 | git ls-files -s file | grep "^100755" | |
42 | ' | |
43 | ||
872f349e | 44 | test_expect_success FILEMODE 'mode update (no index)' ' |
1f7903a3 JH |
45 | git reset --hard && |
46 | git apply patch-1.txt && | |
47 | test -x file | |
48 | ' | |
49 | ||
872f349e | 50 | test_expect_success FILEMODE 'mode update (with index)' ' |
1f7903a3 JH |
51 | git reset --hard && |
52 | git apply --index patch-1.txt && | |
53 | test -x file && | |
54 | git diff --exit-code | |
55 | ' | |
56 | ||
872f349e | 57 | test_expect_success FILEMODE 'mode update (index only)' ' |
1f7903a3 JH |
58 | git reset --hard && |
59 | git apply --cached patch-1.txt && | |
60 | git ls-files -s file | grep "^100755" | |
61 | ' | |
62 | ||
63 | test_done |