test-lib: Introduce test_chmod and use it instead of update-index --chmod
[git/jnareb-git.git] / t / t6031-merge-recursive.sh
blob41c6860be239a2abbab8b66ad8d4909b8913a9cc
1 #!/bin/sh
3 test_description='merge-recursive: handle file mode'
4 . ./test-lib.sh
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 &&
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
22 test_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 &&
35 git merge-recursive master -- a2 b2
36 test $? = 1
37 ) &&
38 git ls-files -u >actual &&
40 echo "100755 $H 2 file2"
41 echo "100644 $H 3 file2"
42 ) >expect &&
43 test_cmp actual expect &&
44 test -x file2
47 test_done