3 test_description
='merge: handle file mode'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9 test_expect_success
'set up mode change in one branch' '
12 git commit -m initial &&
13 git checkout -b a1 main &&
17 git checkout -b b1 main &&
18 test_chmod +x file1 &&
27 test_expect_success
"resolve single mode change ($strategy, $us)" '
28 git checkout -f $us &&
29 git merge -s $strategy $them &&
30 git ls-files -s file1 | grep ^100755
33 test_expect_success FILEMODE
"verify executable bit on file ($strategy, $us)" '
38 do_one_mode recursive a1 b1
39 do_one_mode recursive b1 a1
40 do_one_mode resolve a1 b1
41 do_one_mode resolve b1 a1
43 test_expect_success
'set up mode change in both branches' '
44 git reset --hard HEAD &&
45 git checkout -b a2 main &&
47 H=$(git hash-object file2) &&
48 test_chmod +x file2 &&
50 git checkout -b b2 main &&
62 test_expect_success
"detect conflict on double mode change ($strategy)" '
65 test_must_fail git merge -s $strategy b2 &&
66 git ls-files -u >actual &&
67 test_cmp expect actual &&
68 git ls-files -s file2 | grep ^100755
71 test_expect_success FILEMODE
"verify executable bit on file ($strategy)" '
76 # both sides are equivalent, so no need to run both ways
77 do_both_modes recursive
80 test_expect_success
'set up delete/modechange scenario' '
82 git checkout -b deletion main &&
84 git commit -m deletion
87 do_delete_modechange
() {
91 test_expect_success
"detect delete/modechange conflict ($strategy, $us)" '
94 test_must_fail git merge -s $strategy $them
98 do_delete_modechange recursive b1 deletion
99 do_delete_modechange recursive deletion b1
100 do_delete_modechange resolve b1 deletion
101 do_delete_modechange resolve deletion b1