1#!/bin/sh
2
3test_description='merge-recursive: handle file mode'
4. ./test-lib.sh
5
6test_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 &&
15 test_chmod +x file1 &&
16 git commit -m b1 &&
17 git checkout a1 &&
18 git merge-recursive master -- a1 b1 &&
19 test -x file1
20'
21
22test_expect_success 'mode change in both branches: expect conflict' '
23 git reset --hard HEAD &&
24 git checkout -b a2 master &&
25 : >file2 &&
26 H=$(git hash-object file2) &&
27 test_chmod +x file2 &&
28 git commit -m a2 &&
29 git checkout -b b2 master &&
30 : >file2 &&
31 git add file2 &&
32 git commit -m b2 &&
33 git checkout a2 &&
34 (
35 git merge-recursive master -- a2 b2
36 test $? = 1
37 ) &&
38 git ls-files -u >actual &&
39 (
40 echo "100755 $H 2 file2"
41 echo "100644 $H 3 file2"
42 ) >expect &&
43 test_cmp actual expect &&
44 test -x file2
45'
46
47test_done