3 test_description
='merge: handle file mode'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_PASSES_SANITIZE_LEAK
=true
10 test_expect_success
'set up mode change in one branch' '
13 git commit -m initial &&
14 git checkout -b a1 main &&
18 git checkout -b b1 main &&
19 test_chmod +x file1 &&
28 test_expect_success
"resolve single mode change ($strategy, $us)" '
29 git checkout -f $us &&
30 git merge -s $strategy $them &&
31 git ls-files -s file1 | grep ^100755
34 test_expect_success FILEMODE
"verify executable bit on file ($strategy, $us)" '
39 do_one_mode recursive a1 b1
40 do_one_mode recursive b1 a1
41 do_one_mode resolve a1 b1
42 do_one_mode resolve b1 a1
44 test_expect_success
'set up mode change in both branches' '
45 git reset --hard HEAD &&
46 git checkout -b a2 main &&
48 H=$(git hash-object file2) &&
49 test_chmod +x file2 &&
51 git checkout -b b2 main &&
63 test_expect_success
"detect conflict on double mode change ($strategy)" '
66 test_must_fail git merge -s $strategy b2 &&
67 git ls-files -u >actual &&
68 test_cmp expect actual &&
69 git ls-files -s file2 | grep ^100755
72 test_expect_success FILEMODE
"verify executable bit on file ($strategy)" '
77 # both sides are equivalent, so no need to run both ways
78 do_both_modes recursive
81 test_expect_success
'set up delete/modechange scenario' '
83 git checkout -b deletion main &&
85 git commit -m deletion
88 do_delete_modechange
() {
92 test_expect_success
"detect delete/modechange conflict ($strategy, $us)" '
95 test_must_fail git merge -s $strategy $them
99 do_delete_modechange recursive b1 deletion
100 do_delete_modechange recursive deletion b1
101 do_delete_modechange resolve b1 deletion
102 do_delete_modechange resolve deletion b1