]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4129-apply-samemode.sh
apply: check git diffs for missing old filenames
[thirdparty/git.git] / t / t4129-apply-samemode.sh
CommitLineData
1f7903a3
JH
1#!/bin/sh
2
3test_description='applying patch with mode bits'
4
5. ./test-lib.sh
872f349e 6
1f7903a3
JH
7test_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
872f349e 19test_expect_success FILEMODE 'same mode (no index)' '
1f7903a3
JH
20 git reset --hard &&
21 chmod +x file &&
22 git apply patch-0.txt &&
23 test -x file
24'
25
872f349e 26test_expect_success FILEMODE 'same mode (with index)' '
1f7903a3
JH
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
872f349e 35test_expect_success FILEMODE 'same mode (index only)' '
1f7903a3
JH
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
872f349e 43test_expect_success FILEMODE 'mode update (no index)' '
1f7903a3
JH
44 git reset --hard &&
45 git apply patch-1.txt &&
46 test -x file
47'
48
872f349e 49test_expect_success FILEMODE 'mode update (with index)' '
1f7903a3
JH
50 git reset --hard &&
51 git apply --index patch-1.txt &&
52 test -x file &&
53 git diff --exit-code
54'
55
872f349e 56test_expect_success FILEMODE 'mode update (index only)' '
1f7903a3
JH
57 git reset --hard &&
58 git apply --cached patch-1.txt &&
59 git ls-files -s file | grep "^100755"
60'
61
62test_done