Merge commit 'junio/next' into next
[git/platforms/storm.git] / t / t6031-merge-recursive.sh
blobb1f07caef06f4d985a79d8091a1b8901355830f4
1 #!/bin/sh
3 test_description='merge-recursive: handle file mode'
4 . ./test-lib.sh
6 if test "$(git config --bool core.filemode)" = false; then
7 say "executable bit not honored - skipping tests"
8 test_done
9 fi
11 # Note that we follow "chmod +x F" with "update-index --chmod=+x F" to
12 # help filesystems that do not have the executable bit.
14 test_expect_success 'mode change in one branch: keep changed version' '
15 : >file1 &&
16 git add file1 &&
17 git commit -m initial &&
18 git checkout -b a1 master &&
19 : >dummy &&
20 git add dummy &&
21 git commit -m a &&
22 git checkout -b b1 master &&
23 chmod +x file1 &&
24 git update-index --chmod=+x file1 &&
25 git commit -m b1 &&
26 git checkout a1 &&
27 git merge-recursive master -- a1 b1 &&
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 chmod +x file2 &&
37 git update-index --add --chmod=+x file2 &&
38 git commit -m a2 &&
39 git checkout -b b2 master &&
40 : >file2 &&
41 git add file2 &&
42 git commit -m b2 &&
43 git checkout a2 &&
45 git merge-recursive master -- a2 b2
46 test $? = 1
47 ) &&
48 git ls-files -u >actual &&
50 echo "100755 $H 2 file2"
51 echo "100644 $H 3 file2"
52 ) >expect &&
53 test_cmp actual expect &&
54 test -x file2
57 test_done