]>
Commit | Line | Data |
---|---|---|
1affea4f CB |
1 | #!/bin/sh |
2 | ||
3 | test_description='merge-recursive: handle file mode' | |
4 | . ./test-lib.sh | |
535d9742 | 5 | . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh |
872f349e | 6 | |
1affea4f CB |
7 | test_expect_success 'mode change in one branch: keep changed version' ' |
8 | : >file1 && | |
9 | git add file1 && | |
10 | git commit -m initial && | |
11 | git checkout -b a1 master && | |
12 | : >dummy && | |
13 | git add dummy && | |
14 | git commit -m a && | |
15 | git checkout -b b1 master && | |
1f553918 | 16 | test_chmod +x file1 && |
1affea4f CB |
17 | git commit -m b1 && |
18 | git checkout a1 && | |
19 | git merge-recursive master -- a1 b1 && | |
872f349e JS |
20 | git ls-files -s file1 | grep ^100755 |
21 | ' | |
22 | ||
23 | test_expect_success FILEMODE 'verify executable bit on file' ' | |
1affea4f CB |
24 | test -x file1 |
25 | ' | |
26 | ||
27 | test_expect_success 'mode change in both branches: expect conflict' ' | |
28 | git reset --hard HEAD && | |
29 | git checkout -b a2 master && | |
30 | : >file2 && | |
31 | H=$(git hash-object file2) && | |
1f553918 | 32 | test_chmod +x file2 && |
1affea4f CB |
33 | git commit -m a2 && |
34 | git checkout -b b2 master && | |
35 | : >file2 && | |
36 | git add file2 && | |
37 | git commit -m b2 && | |
38 | git checkout a2 && | |
39 | ( | |
40 | git merge-recursive master -- a2 b2 | |
41 | test $? = 1 | |
42 | ) && | |
43 | git ls-files -u >actual && | |
44 | ( | |
45 | echo "100755 $H 2 file2" | |
46 | echo "100644 $H 3 file2" | |
47 | ) >expect && | |
1f9ff0de | 48 | test_cmp actual expect && |
872f349e JS |
49 | git ls-files -s file2 | grep ^100755 |
50 | ' | |
51 | ||
52 | test_expect_success FILEMODE 'verify executable bit on file' ' | |
1affea4f CB |
53 | test -x file2 |
54 | ' | |
55 | ||
ae745487 | 56 | test_expect_success 'merging with triple rename across D/F conflict' ' |
5601ba65 EN |
57 | git reset --hard HEAD && |
58 | git checkout -b main && | |
59 | git rm -rf . && | |
60 | ||
61 | echo "just a file" >sub1 && | |
62 | mkdir -p sub2 && | |
63 | echo content1 >sub2/file1 && | |
64 | echo content2 >sub2/file2 && | |
65 | echo content3 >sub2/file3 && | |
66 | mkdir simple && | |
67 | echo base >simple/bar && | |
68 | git add -A && | |
69 | test_tick && | |
70 | git commit -m base && | |
71 | ||
72 | git checkout -b other && | |
73 | echo more >>simple/bar && | |
74 | test_tick && | |
75 | git commit -a -m changesimplefile && | |
76 | ||
77 | git checkout main && | |
78 | git rm sub1 && | |
79 | git mv sub2 sub1 && | |
80 | test_tick && | |
81 | git commit -m changefiletodir && | |
82 | ||
83 | test_tick && | |
84 | git merge other | |
85 | ' | |
86 | ||
1affea4f | 87 | test_done |