]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4129-apply-samemode.sh
l10n: Update Swedish translation (1979t0f0u)
[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
535d9742 6. "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
872f349e 7
1f7903a3
JH
8test_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 20test_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 27test_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 36test_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 44test_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 50test_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 57test_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
63test_done