Ensure that a test is run in the trash directory
[git/spearce.git] / t / t6031-merge-recursive.sh
blobc8310aee4f77e19281b2559c1f52804c7c98a81d
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 chmod +x file1 &&
16 git add file1 &&
17 git commit -m b1 &&
18 git checkout a1 &&
19 git merge-recursive master -- a1 b1 &&
20 test -x file1
23 test_expect_success 'mode change in both branches: expect conflict' '
24 git reset --hard HEAD &&
25 git checkout -b a2 master &&
26 : >file2 &&
27 H=$(git hash-object file2) &&
28 chmod +x file2 &&
29 git add file2 &&
30 git commit -m a2 &&
31 git checkout -b b2 master &&
32 : >file2 &&
33 git add file2 &&
34 git commit -m b2 &&
35 git checkout a2 &&
37 git merge-recursive master -- a2 b2
38 test $? = 1
39 ) &&
40 git ls-files -u >actual &&
42 echo "100755 $H 2 file2"
43 echo "100644 $H 3 file2"
44 ) >expect &&
45 test_cmp actual expect &&
46 test -x file2
49 test_done