@ -7,25 +7,25 @@ test_description='git mergetool
Testing basic merge tool invocation'
Testing basic merge tool invocation'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
. ./test-lib.sh
# All the mergetool test work by checking out a temporary branch based
# All the mergetool test work by checking out a temporary branch based
# off 'branch1' and then merging in master and checking the results of
# off 'branch1' and then merging in main and checking the results of
# running mergetool
# running mergetool
test_expect_success 'setup' '
test_expect_success 'setup' '
test_config rerere.enabled true &&
test_config rerere.enabled true &&
echo master >file1 &&
echo main >file1 &&
echo master spaced >"spaced name" &&
echo main spaced >"spaced name" &&
echo master file11 >file11 &&
echo main file11 >file11 &&
echo master file12 >file12 &&
echo main file12 >file12 &&
echo master file13 >file13 &&
echo main file13 >file13 &&
echo master file14 >file14 &&
echo main file14 >file14 &&
mkdir subdir &&
mkdir subdir &&
echo master sub >subdir/file3 &&
echo main sub >subdir/file3 &&
test_create_repo submod &&
test_create_repo submod &&
(
(
cd submod &&
cd submod &&
@ -37,7 +37,7 @@ test_expect_success 'setup' '
git add file1 "spaced name" file1[1-4] subdir/file3 .gitmodules submod &&
git add file1 "spaced name" file1[1-4] subdir/file3 .gitmodules submod &&
git commit -m "add initial versions" &&
git commit -m "add initial versions" &&
git checkout -b branch1 master &&
git checkout -b branch1 main &&
git submodule update -N &&
git submodule update -N &&
echo branch1 change >file1 &&
echo branch1 change >file1 &&
echo branch1 newfile >file2 &&
echo branch1 newfile >file2 &&
@ -74,39 +74,39 @@ test_expect_success 'setup' '
test_write_lines one two 3 >c/c/file.txt &&
test_write_lines one two 3 >c/c/file.txt &&
git commit -a -m"move to c" &&
git commit -a -m"move to c" &&
git checkout -b stash1 master &&
git checkout -b stash1 main &&
echo stash1 change file11 >file11 &&
echo stash1 change file11 >file11 &&
git add file11 &&
git add file11 &&
git commit -m "stash1 changes" &&
git commit -m "stash1 changes" &&
git checkout -b stash2 master &&
git checkout -b stash2 main &&
echo stash2 change file11 >file11 &&
echo stash2 change file11 >file11 &&
git add file11 &&
git add file11 &&
git commit -m "stash2 changes" &&
git commit -m "stash2 changes" &&
git checkout master &&
git checkout main &&
git submodule update -N &&
git submodule update -N &&
echo master updated >file1 &&
echo main updated >file1 &&
echo master new >file2 &&
echo main new >file2 &&
echo master updated spaced >"spaced name" &&
echo main updated spaced >"spaced name" &&
echo master both added >both &&
echo main both added >both &&
echo master updated file12 >file12 &&
echo main updated file12 >file12 &&
echo master updated file14 >file14 &&
echo main updated file14 >file14 &&
echo master new sub >subdir/file3 &&
echo main new sub >subdir/file3 &&
(
(
cd submod &&
cd submod &&
echo master submodule >bar &&
echo main submodule >bar &&
git add bar &&
git add bar &&
git commit -m "Add bar on master" &&
git commit -m "Add bar on main" &&
git checkout -b submod-master
git checkout -b submod-main
) &&
) &&
git add file1 "spaced name" file12 file14 file2 subdir/file3 submod &&
git add file1 "spaced name" file12 file14 file2 subdir/file3 submod &&
git add both &&
git add both &&
git rm file11 &&
git rm file11 &&
git commit -m "master updates" &&
git commit -m "main updates" &&
git clean -fdx &&
git clean -fdx &&
git checkout -b order-file-start master &&
git checkout -b order-file-start main &&
echo start >a &&
echo start >a &&
echo start >b &&
echo start >b &&
git add a b &&
git add a b &&
@ -133,7 +133,7 @@ test_expect_success 'custom mergetool' '
test_when_finished "git reset --hard" &&
test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool both &&
yes "" | git mergetool both &&
yes "" | git mergetool file1 file1 &&
yes "" | git mergetool file1 file1 &&
yes "" | git mergetool file2 "spaced name" &&
yes "" | git mergetool file2 "spaced name" &&
@ -141,11 +141,11 @@ test_expect_success 'custom mergetool' '
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 &&
yes "d" | git mergetool file12 &&
yes "l" | git mergetool submod &&
yes "l" | git mergetool submod &&
echo "master updated" >expect &&
echo "main updated" >expect &&
test_cmp expect file1 &&
test_cmp expect file1 &&
echo "master new" >expect &&
echo "main new" >expect &&
test_cmp expect file2 &&
test_cmp expect file2 &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect subdir/file3 &&
test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
@ -159,7 +159,7 @@ test_expect_success 'gui mergetool' '
test_when_finished "git reset --hard" &&
test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool --gui both &&
yes "" | git mergetool --gui both &&
yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool --gui file2 "spaced name" &&
yes "" | git mergetool --gui file2 "spaced name" &&
@ -167,11 +167,11 @@ test_expect_success 'gui mergetool' '
yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file12 &&
yes "d" | git mergetool --gui file12 &&
yes "l" | git mergetool --gui submod &&
yes "l" | git mergetool --gui submod &&
echo "gui master updated" >expect &&
echo "gui main updated" >expect &&
test_cmp expect file1 &&
test_cmp expect file1 &&
echo "gui master new" >expect &&
echo "gui main new" >expect &&
test_cmp expect file2 &&
test_cmp expect file2 &&
echo "gui master new sub" >expect &&
echo "gui main new sub" >expect &&
test_cmp expect subdir/file3 &&
test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
@ -182,7 +182,7 @@ test_expect_success 'gui mergetool without merge.guitool set falls back to merge
test_when_finished "git reset --hard" &&
test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool --gui both &&
yes "" | git mergetool --gui both &&
yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool -g file1 file1 &&
yes "" | git mergetool --gui file2 "spaced name" &&
yes "" | git mergetool --gui file2 "spaced name" &&
@ -190,11 +190,11 @@ test_expect_success 'gui mergetool without merge.guitool set falls back to merge
yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file11 &&
yes "d" | git mergetool --gui file12 &&
yes "d" | git mergetool --gui file12 &&
yes "l" | git mergetool --gui submod &&
yes "l" | git mergetool --gui submod &&
echo "master updated" >expect &&
echo "main updated" >expect &&
test_cmp expect file1 &&
test_cmp expect file1 &&
echo "master new" >expect &&
echo "main new" >expect &&
test_cmp expect file2 &&
test_cmp expect file2 &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect subdir/file3 &&
test_cmp expect subdir/file3 &&
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
@ -209,7 +209,7 @@ test_expect_success 'mergetool crlf' '
# test_when_finished is LIFO.)
# test_when_finished is LIFO.)
test_config core.autocrlf true &&
test_config core.autocrlf true &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool file1 &&
yes "" | git mergetool file1 &&
yes "" | git mergetool file2 &&
yes "" | git mergetool file2 &&
yes "" | git mergetool "spaced name" &&
yes "" | git mergetool "spaced name" &&
@ -218,11 +218,11 @@ test_expect_success 'mergetool crlf' '
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 &&
yes "d" | git mergetool file12 &&
yes "r" | git mergetool submod &&
yes "r" | git mergetool submod &&
test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" &&
test "$(printf x | cat file1 -)" = "$(printf "main updated\r\nx")" &&
test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" &&
test "$(printf x | cat file2 -)" = "$(printf "main new\r\nx")" &&
test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" &&
test "$(printf x | cat subdir/file3 -)" = "$(printf "main new sub\r\nx")" &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git commit -m "branch1 resolved with mergetool - autocrlf"
git commit -m "branch1 resolved with mergetool - autocrlf"
'
'
@ -233,9 +233,9 @@ test_expect_success 'mergetool in subdir' '
git submodule update -N &&
git submodule update -N &&
(
(
cd subdir &&
cd subdir &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool file3 &&
yes "" | git mergetool file3 &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect file3
test_cmp expect file3
)
)
'
'
@ -246,7 +246,7 @@ test_expect_success 'mergetool on file in parent dir' '
git submodule update -N &&
git submodule update -N &&
(
(
cd subdir &&
cd subdir &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool file3 &&
yes "" | git mergetool file3 &&
yes "" | git mergetool ../file1 &&
yes "" | git mergetool ../file1 &&
yes "" | git mergetool ../file2 ../spaced\ name &&
yes "" | git mergetool ../file2 ../spaced\ name &&
@ -254,9 +254,9 @@ test_expect_success 'mergetool on file in parent dir' '
yes "d" | git mergetool ../file11 &&
yes "d" | git mergetool ../file11 &&
yes "d" | git mergetool ../file12 &&
yes "d" | git mergetool ../file12 &&
yes "l" | git mergetool ../submod &&
yes "l" | git mergetool ../submod &&
echo "master updated" >expect &&
echo "main updated" >expect &&
test_cmp expect ../file1 &&
test_cmp expect ../file1 &&
echo "master new" >expect &&
echo "main new" >expect &&
test_cmp expect ../file2 &&
test_cmp expect ../file2 &&
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect ../submod/bar &&
test_cmp expect ../submod/bar &&
@ -268,7 +268,7 @@ test_expect_success 'mergetool skips autoresolved' '
test_when_finished "git reset --hard" &&
test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file11 &&
yes "d" | git mergetool file12 &&
yes "d" | git mergetool file12 &&
@ -283,17 +283,17 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' '
test_config rerere.enabled false &&
test_config rerere.enabled false &&
(
(
cd subdir &&
cd subdir &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "r" | git mergetool ../submod &&
yes "r" | git mergetool ../submod &&
yes "d" "d" | git mergetool --no-prompt &&
yes "d" "d" | git mergetool --no-prompt &&
echo "master updated" >expect &&
echo "main updated" >expect &&
test_cmp expect ../file1 &&
test_cmp expect ../file1 &&
echo "master new" >expect &&
echo "main new" >expect &&
test_cmp expect ../file2 &&
test_cmp expect ../file2 &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect file3 &&
test_cmp expect file3 &&
( cd .. && git submodule update -N ) &&
( cd .. && git submodule update -N ) &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect ../submod/bar &&
test_cmp expect ../submod/bar &&
git commit -m "branch2 resolved by mergetool from subdir"
git commit -m "branch2 resolved by mergetool from subdir"
)
)
@ -306,17 +306,17 @@ test_expect_success 'mergetool merges all from subdir (rerere enabled)' '
rm -rf .git/rr-cache &&
rm -rf .git/rr-cache &&
(
(
cd subdir &&
cd subdir &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "r" | git mergetool ../submod &&
yes "r" | git mergetool ../submod &&
yes "d" "d" | git mergetool --no-prompt &&
yes "d" "d" | git mergetool --no-prompt &&
echo "master updated" >expect &&
echo "main updated" >expect &&
test_cmp expect ../file1 &&
test_cmp expect ../file1 &&
echo "master new" >expect &&
echo "main new" >expect &&
test_cmp expect ../file2 &&
test_cmp expect ../file2 &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect file3 &&
test_cmp expect file3 &&
( cd .. && git submodule update -N ) &&
( cd .. && git submodule update -N ) &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect ../submod/bar &&
test_cmp expect ../submod/bar &&
git commit -m "branch2 resolved by mergetool from subdir"
git commit -m "branch2 resolved by mergetool from subdir"
)
)
@ -328,7 +328,7 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '
rm -rf .git/rr-cache &&
rm -rf .git/rr-cache &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "l" | git mergetool --no-prompt submod &&
yes "l" | git mergetool --no-prompt submod &&
yes "d" "d" | git mergetool --no-prompt &&
yes "d" "d" | git mergetool --no-prompt &&
git submodule update -N &&
git submodule update -N &&
@ -369,11 +369,11 @@ test_expect_success 'mergetool takes partial path' '
test_config rerere.enabled false &&
test_config rerere.enabled false &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
yes "" | git mergetool subdir &&
yes "" | git mergetool subdir &&
echo "master new sub" >expect &&
echo "main new sub" >expect &&
test_cmp expect subdir/file3
test_cmp expect subdir/file3
'
'
@ -437,7 +437,7 @@ test_expect_success 'deleted vs modified submodule' '
git rm --cached submod &&
git rm --cached submod &&
git commit -m "Submodule deleted from branch" &&
git commit -m "Submodule deleted from branch" &&
git checkout -b test$test_count.a test$test_count &&
git checkout -b test$test_count.a test$test_count &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "" | git mergetool both &&
@ -447,7 +447,7 @@ test_expect_success 'deleted vs modified submodule' '
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" &&
output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
@ -456,7 +456,7 @@ test_expect_success 'deleted vs modified submodule' '
mv submod submod-movedaside &&
mv submod submod-movedaside &&
git checkout -b test$test_count.b test$test_count &&
git checkout -b test$test_count.b test$test_count &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "" | git mergetool both &&
@ -468,7 +468,7 @@ test_expect_success 'deleted vs modified submodule' '
git commit -m "Merge resolved by deleting module" &&
git commit -m "Merge resolved by deleting module" &&
mv submod-movedaside submod &&
mv submod-movedaside submod &&
git checkout -b test$test_count.c master &&
git checkout -b test$test_count.c main &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge test$test_count &&
test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
@ -484,7 +484,7 @@ test_expect_success 'deleted vs modified submodule' '
git commit -m "Merge resolved by deleting module" &&
git commit -m "Merge resolved by deleting module" &&
mv submod.orig submod &&
mv submod.orig submod &&
git checkout -b test$test_count.d master &&
git checkout -b test$test_count.d main &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge test$test_count &&
test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
@ -492,10 +492,10 @@ test_expect_success 'deleted vs modified submodule' '
yes "" | git mergetool both &&
yes "" | git mergetool both &&
yes "d" | git mergetool file11 file12 &&
yes "d" | git mergetool file11 file12 &&
yes "l" | git mergetool submod &&
yes "l" | git mergetool submod &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" &&
output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
@ -512,7 +512,7 @@ test_expect_success 'file vs modified submodule' '
git add submod &&
git add submod &&
git commit -m "Submodule path becomes file" &&
git commit -m "Submodule path becomes file" &&
git checkout -b test$test_count.a branch1 &&
git checkout -b test$test_count.a branch1 &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "" | git mergetool both &&
@ -522,7 +522,7 @@ test_expect_success 'file vs modified submodule' '
echo "branch1 submodule" >expect &&
echo "branch1 submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" &&
output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
@ -530,7 +530,7 @@ test_expect_success 'file vs modified submodule' '
mv submod submod-movedaside &&
mv submod submod-movedaside &&
git checkout -b test$test_count.b test$test_count &&
git checkout -b test$test_count.b test$test_count &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "" | git mergetool both &&
@ -550,7 +550,7 @@ test_expect_success 'file vs modified submodule' '
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
git commit -m "Merge resolved by keeping file" &&
git commit -m "Merge resolved by keeping file" &&
git checkout -b test$test_count.c master &&
git checkout -b test$test_count.c main &&
rmdir submod && mv submod-movedaside submod &&
rmdir submod && mv submod-movedaside submod &&
test ! -e submod.orig &&
test ! -e submod.orig &&
git submodule update -N &&
git submodule update -N &&
@ -576,7 +576,7 @@ test_expect_success 'file vs modified submodule' '
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
git commit -m "Merge resolved by keeping file" &&
git commit -m "Merge resolved by keeping file" &&
git checkout -b test$test_count.d master &&
git checkout -b test$test_count.d main &&
rmdir submod && mv submod.orig submod &&
rmdir submod && mv submod.orig submod &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge test$test_count &&
test_must_fail git merge test$test_count &&
@ -589,10 +589,10 @@ test_expect_success 'file vs modified submodule' '
then
then
yes "d" | git mergetool submod~test19
yes "d" | git mergetool submod~test19
fi &&
fi &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
output="$(git mergetool --no-prompt)" &&
output="$(git mergetool --no-prompt)" &&
test "$output" = "No files need merging" &&
test "$output" = "No files need merging" &&
@ -675,7 +675,7 @@ test_expect_success 'directory vs modified submodule' '
git add submod/file16 &&
git add submod/file16 &&
git commit -m "Submodule path becomes directory" &&
git commit -m "Submodule path becomes directory" &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "l" | git mergetool submod &&
yes "l" | git mergetool submod &&
echo "not a submodule" >expect &&
echo "not a submodule" >expect &&
@ -683,14 +683,14 @@ test_expect_success 'directory vs modified submodule' '
rm -rf submod.orig &&
rm -rf submod.orig &&
git reset --hard &&
git reset --hard &&
test_must_fail git merge master &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
test ! -e submod.orig &&
test ! -e submod.orig &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
then
yes "r" | git mergetool submod~master &&
yes "r" | git mergetool submod~main &&
git mv submod submod.orig &&
git mv submod submod.orig &&
git mv submod~master submod
git mv submod~main submod
else
else
yes "r" | git mergetool submod
yes "r" | git mergetool submod
fi &&
fi &&
@ -701,18 +701,18 @@ test_expect_success 'directory vs modified submodule' '
mv submod-movedaside/.git submod &&
mv submod-movedaside/.git submod &&
( cd submod && git clean -f && git reset --hard ) &&
( cd submod && git clean -f && git reset --hard ) &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git reset --hard &&
git reset --hard &&
rm -rf submod-movedaside &&
rm -rf submod-movedaside &&
git checkout -b test$test_count.c master &&
git checkout -b test$test_count.c main &&
git submodule update -N &&
git submodule update -N &&
test_must_fail git merge test$test_count &&
test_must_fail git merge test$test_count &&
test -n "$(git ls-files -u)" &&
test -n "$(git ls-files -u)" &&
yes "l" | git mergetool submod &&
yes "l" | git mergetool submod &&
git submodule update -N &&
git submodule update -N &&
echo "master submodule" >expect &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
test_cmp expect submod/bar &&
git reset --hard &&
git reset --hard &&
@ -724,7 +724,7 @@ test_expect_success 'directory vs modified submodule' '
echo "not a submodule" >expect &&
echo "not a submodule" >expect &&
test_cmp expect submod/file16 &&
test_cmp expect submod/file16 &&
git reset --hard master &&
git reset --hard main &&
( cd submod && git clean -f && git reset --hard ) &&
( cd submod && git clean -f && git reset --hard ) &&
git submodule update -N
git submodule update -N
'
'
@ -732,7 +732,7 @@ test_expect_success 'directory vs modified submodule' '
test_expect_success 'file with no base' '
test_expect_success 'file with no base' '
test_when_finished "git reset --hard" &&
test_when_finished "git reset --hard" &&
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
test_must_fail git merge master &&
test_must_fail git merge main &&
git mergetool --no-prompt --tool mybase -- both &&
git mergetool --no-prompt --tool mybase -- both &&
test_must_be_empty both
test_must_be_empty both
'
'
@ -742,9 +742,9 @@ test_expect_success 'custom commands override built-ins' '
git checkout -b test$test_count branch1 &&
git checkout -b test$test_count branch1 &&
test_config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
test_config mergetool.defaults.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
test_config mergetool.defaults.trustExitCode true &&
test_config mergetool.defaults.trustExitCode true &&
test_must_fail git merge master &&
test_must_fail git merge main &&
git mergetool --no-prompt --tool defaults -- both &&
git mergetool --no-prompt --tool defaults -- both &&
echo master both added >expected &&
echo main both added >expected &&
test_cmp expected both
test_cmp expected both
'
'
@ -754,7 +754,7 @@ test_expect_success 'filenames seen by tools start with ./' '
test_config mergetool.writeToTemp false &&
test_config mergetool.writeToTemp false &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.trustExitCode true &&
test_config mergetool.myecho.trustExitCode true &&
test_must_fail git merge master &&
test_must_fail git merge main &&
git mergetool --no-prompt --tool myecho -- both >actual &&
git mergetool --no-prompt --tool myecho -- both >actual &&
grep ^\./both_LOCAL_ actual
grep ^\./both_LOCAL_ actual
'
'
@ -771,7 +771,7 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
test_config mergetool.writeToTemp true &&
test_config mergetool.writeToTemp true &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
test_config mergetool.myecho.trustExitCode true &&
test_config mergetool.myecho.trustExitCode true &&
test_must_fail git merge master &&
test_must_fail git merge main &&
git mergetool --no-prompt --tool myecho -- both >actual &&
git mergetool --no-prompt --tool myecho -- both >actual &&
! grep ^\./both_LOCAL_ actual &&
! grep ^\./both_LOCAL_ actual &&
grep /both_LOCAL_ actual
grep /both_LOCAL_ actual