Merge branch 'dg/local-mod-error-messages'
[git/jnareb-git.git] / t / t6031-merge-recursive.sh
blobbd75e0e6430ff6e536f0b10d28cc4793d0f7fe6c
1 #!/bin/sh
3 test_description='merge-recursive: handle file mode'
4 . ./test-lib.sh
6 if ! test "$(git config --bool core.filemode)" = false
7 then
8 test_set_prereq FILEMODE
9 fi
11 test_expect_success 'mode change in one branch: keep changed version' '
12 : >file1 &&
13 git add file1 &&
14 git commit -m initial &&
15 git checkout -b a1 master &&
16 : >dummy &&
17 git add dummy &&
18 git commit -m a &&
19 git checkout -b b1 master &&
20 test_chmod +x file1 &&
21 git commit -m b1 &&
22 git checkout a1 &&
23 git merge-recursive master -- a1 b1 &&
24 git ls-files -s file1 | grep ^100755
27 test_expect_success FILEMODE 'verify executable bit on file' '
28 test -x file1
31 test_expect_success 'mode change in both branches: expect conflict' '
32 git reset --hard HEAD &&
33 git checkout -b a2 master &&
34 : >file2 &&
35 H=$(git hash-object file2) &&
36 test_chmod +x file2 &&
37 git commit -m a2 &&
38 git checkout -b b2 master &&
39 : >file2 &&
40 git add file2 &&
41 git commit -m b2 &&
42 git checkout a2 &&
44 git merge-recursive master -- a2 b2
45 test $? = 1
46 ) &&
47 git ls-files -u >actual &&
49 echo "100755 $H 2 file2"
50 echo "100644 $H 3 file2"
51 ) >expect &&
52 test_cmp actual expect &&
53 git ls-files -s file2 | grep ^100755
56 test_expect_success FILEMODE 'verify executable bit on file' '
57 test -x file2
60 test_expect_success 'merging with triple rename across D/F conflict' '
61 git reset --hard HEAD &&
62 git checkout -b main &&
63 git rm -rf . &&
65 echo "just a file" >sub1 &&
66 mkdir -p sub2 &&
67 echo content1 >sub2/file1 &&
68 echo content2 >sub2/file2 &&
69 echo content3 >sub2/file3 &&
70 mkdir simple &&
71 echo base >simple/bar &&
72 git add -A &&
73 test_tick &&
74 git commit -m base &&
76 git checkout -b other &&
77 echo more >>simple/bar &&
78 test_tick &&
79 git commit -a -m changesimplefile &&
81 git checkout main &&
82 git rm sub1 &&
83 git mv sub2 sub1 &&
84 test_tick &&
85 git commit -m changefiletodir &&
87 test_tick &&
88 git merge other
91 test_done