gitweb: add patch view
[git.git] / t / t6031-merge-recursive.sh
blob8073e0c3efb2ac01e4a81e722fc357bcab13f5d4
1 #!/bin/sh
3 test_description='merge-recursive: handle file mode'
4 . ./test-lib.sh
6 # Note that we follow "chmod +x F" with "update-index --chmod=+x F" to
7 # help filesystems that do not have the executable bit.
9 test_expect_success 'mode change in one branch: keep changed version' '
10 : >file1 &&
11 git add file1 &&
12 git commit -m initial &&
13 git checkout -b a1 master &&
14 : >dummy &&
15 git add dummy &&
16 git commit -m a &&
17 git checkout -b b1 master &&
18 chmod +x file1 &&
19 git update-index --chmod=+x file1 &&
20 git commit -m b1 &&
21 git checkout a1 &&
22 git merge-recursive master -- a1 b1 &&
23 test -x file1
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) &&
31 chmod +x file2 &&
32 git update-index --add --chmod=+x file2 &&
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 &&
40 git merge-recursive master -- a2 b2
41 test $? = 1
42 ) &&
43 git ls-files -u >actual &&
45 echo "100755 $H 2 file2"
46 echo "100644 $H 3 file2"
47 ) >expect &&
48 test_cmp actual expect &&
49 test -x file2
52 test_done