3 test_description
='merge: handle file mode'
6 test_expect_success
'set up mode change in one branch' '
9 git commit -m initial &&
10 git checkout -b a1 master &&
14 git checkout -b b1 master &&
15 test_chmod +x file1 &&
24 test_expect_success
"resolve single mode change ($strategy, $us)" '
25 git checkout -f $us &&
26 git merge -s $strategy $them &&
27 git ls-files -s file1 | grep ^100755
30 test_expect_success FILEMODE
"verify executable bit on file ($strategy, $us)" '
35 do_one_mode recursive a1 b1
36 do_one_mode recursive b1 a1
37 do_one_mode resolve a1 b1
38 do_one_mode resolve b1 a1
40 test_expect_success
'set up mode change in both branches' '
41 git reset --hard HEAD &&
42 git checkout -b a2 master &&
44 H=$(git hash-object file2) &&
45 test_chmod +x file2 &&
47 git checkout -b b2 master &&
52 echo "100755 $H 2 file2"
53 echo "100644 $H 3 file2"
59 test_expect_success
"detect conflict on double mode change ($strategy)" '
62 test_must_fail git merge -s $strategy b2 &&
63 git ls-files -u >actual &&
64 test_cmp actual expect &&
65 git ls-files -s file2 | grep ^100755
68 test_expect_success FILEMODE
"verify executable bit on file ($strategy)" '
73 # both sides are equivalent, so no need to run both ways
74 do_both_modes recursive
77 test_expect_success
'set up delete/modechange scenario' '
79 git checkout -b deletion master &&
81 git commit -m deletion
84 do_delete_modechange
() {
88 test_expect_success
"detect delete/modechange conflict ($strategy, $us)" '
91 test_must_fail git merge -s $strategy $them
95 do_delete_modechange recursive b1 deletion
96 do_delete_modechange recursive deletion b1
97 do_delete_modechange resolve b1 deletion
98 do_delete_modechange resolve deletion b1