Git 1.6.6.1
[git/mingw/4msysgit/kblees.git] / t / t6031-merge-recursive.sh
blob8a3304fb0b5901fb02435d3b77c3d049404f4e25
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_done