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