Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='applying patch with mode bits' |
| 4 | |
| 5 | . ./test-lib.sh |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 6 | |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 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 |
| 17 | ' |
| 18 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 19 | test_expect_success FILEMODE 'same mode (no index)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 20 | git reset --hard && |
| 21 | chmod +x file && |
| 22 | git apply patch-0.txt && |
| 23 | test -x file |
| 24 | ' |
| 25 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 26 | test_expect_success FILEMODE 'same mode (with index)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 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 |
| 33 | ' |
| 34 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 35 | test_expect_success FILEMODE 'same mode (index only)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 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" |
| 41 | ' |
| 42 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 43 | test_expect_success FILEMODE 'mode update (no index)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 44 | git reset --hard && |
| 45 | git apply patch-1.txt && |
| 46 | test -x file |
| 47 | ' |
| 48 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 49 | test_expect_success FILEMODE 'mode update (with index)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 50 | git reset --hard && |
| 51 | git apply --index patch-1.txt && |
| 52 | test -x file && |
| 53 | git diff --exit-code |
| 54 | ' |
| 55 | |
Johannes Sixt | 872f349 | 2009-02-27 22:20:57 +0100 | [diff] [blame] | 56 | test_expect_success FILEMODE 'mode update (index only)' ' |
Junio C Hamano | 1f7903a | 2009-01-02 02:55:37 -0800 | [diff] [blame] | 57 | git reset --hard && |
| 58 | git apply --cached patch-1.txt && |
| 59 | git ls-files -s file | grep "^100755" |
| 60 | ' |
| 61 | |
| 62 | test_done |