linux-TEST-vars)
export OPENSSL_SHA1_UNSAFE=YesPlease
export GIT_TEST_SPLIT_INDEX=yes
- export GIT_TEST_MERGE_ALGORITHM=recursive
export GIT_TEST_FULL_IN_PACK_ARRAY=true
export GIT_TEST_OE_SIZE=10
export GIT_TEST_OE_DELTA_SIZE=5
+++ /dev/null
-# Helper functions used by merge tests.
-
-test_expect_merge_algorithm () {
- status_for_recursive=$1 status_for_ort=$2
- shift 2
-
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_expect_${status_for_ort} "$@"
- else
- test_expect_${status_for_recursive} "$@"
- fi
-}
ensure_not_expanded checkout -f update-deep &&
test_config -C sparse-index pull.twohead ort &&
(
- sane_unset GIT_TEST_MERGE_ALGORITHM &&
for OPERATION in "merge -m merge" cherry-pick rebase
do
ensure_not_expanded merge -m merge update-folder1 &&
done &&
(
- sane_unset GIT_TEST_MERGE_ALGORITHM &&
git -C sparse-index config pull.twohead ort &&
ensure_not_expanded ! merge -m merged expand-right
)
grep "Refusing to remove the current working directory" error
'
-GIT_TEST_MERGE_ALGORITHM=ort
-
test_expect_success 'merge fails if cwd needs to be removed' '
test_required_dir_removal git merge fd_conflict
'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
-if test "$GIT_TEST_MERGE_ALGORITHM" != ort
-then
- KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
- KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
-fi
test_submodule_switch "cherry-pick"
test_expect_success 'unrelated submodule/file conflict is ignored' '
git revert HEAD
}
-if test "$GIT_TEST_MERGE_ALGORITHM" != ort
-then
- KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
-fi
test_submodule_switch_func "git_revert"
test_done
. ./test-lib.sh
-# This test is ort-specific
-if test "${GIT_TEST_MERGE_ALGORITHM}" != ort
-then
- skip_all="GIT_TEST_MERGE_ALGORITHM != ort"
- test_done
-fi
-
test_expect_success 'setup basic merges' '
test_write_lines 1 2 3 4 5 6 7 8 9 >numbers &&
git add numbers &&
. ./test-lib.sh
-# This test is ort-specific
-if test "$GIT_TEST_MERGE_ALGORITHM" != "ort"
-then
- skip_all="GIT_TEST_MERGE_ALGORITHM != ort"
- test_done
-fi
-
test_expect_success setup '
test_write_lines 1 2 3 4 5 >numbers &&
echo hello >greeting &&
$2 git pull --no-ff
}
-if test "$GIT_TEST_MERGE_ALGORITHM" != ort
-then
- KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
- KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
-fi
test_submodule_switch_func "git_pull_noff"
test_expect_success 'setup' '
test_stdout_line_count = 5 git ls-files -s &&
test_stdout_line_count = 4 git ls-files -u &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 0 git ls-files -o
- else
- test_stdout_line_count = 1 git ls-files -o
- fi &&
+ test_stdout_line_count = 0 git ls-files -o &&
test_path_is_file letters/file &&
test_path_is_file letters.txt &&
test_stdout_line_count = 5 git ls-files -s &&
test_stdout_line_count = 4 git ls-files -u &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 0 git ls-files -o
- else
- test_stdout_line_count = 1 git ls-files -o
- fi &&
+ test_stdout_line_count = 0 git ls-files -o &&
test_path_is_file letters/file &&
test_path_is_file letters.txt &&
test_grep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
test_grep "Auto-merging dir" output &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_grep "moving it to dir~HEAD instead" output
- else
- test_grep "Adding as dir~HEAD instead" output
- fi &&
+ test_grep "moving it to dir~HEAD instead" output &&
test_stdout_line_count = 3 git ls-files -u &&
test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
! grep "error: refusing to lose untracked file at" errors &&
test_grep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
test_grep "Auto-merging dir" output &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_grep "moving it to dir~renamed-file-has-no-conflicts instead" output
- else
- test_grep "Adding as dir~renamed-file-has-no-conflicts instead" output
- fi &&
+ test_grep "moving it to dir~renamed-file-has-no-conflicts instead" output &&
test_stdout_line_count = 3 git ls-files -u &&
test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
test_must_fail git merge --strategy=recursive dir-in-way &&
test_stdout_line_count = 5 git ls-files -u &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 3 git ls-files -u dir~HEAD
- else
- git ls-files -u dir >out &&
- test 3 -eq $(grep -v file-in-the-way out | wc -l) &&
- rm -f out
- fi &&
+ test_stdout_line_count = 3 git ls-files -u dir~HEAD &&
test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
test_must_fail git diff --quiet &&
test_must_fail git merge --strategy=recursive renamed-file-has-conflicts &&
test_stdout_line_count = 5 git ls-files -u &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 3 git ls-files -u dir~renamed-file-has-conflicts
- else
- git ls-files -u dir >out &&
- test 3 -eq $(grep -v file-in-the-way out | wc -l) &&
- rm -f out
- fi &&
+ test_stdout_line_count = 3 git ls-files -u dir~renamed-file-has-conflicts &&
test_stdout_line_count = 2 git ls-files -u dir/file-in-the-way &&
test_must_fail git diff --quiet &&
git checkout -q rename-dest^0 &&
test_must_fail git merge --strategy=recursive source-conflict &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 2 git ls-files -u
- else
- test_stdout_line_count = 1 git ls-files -u
- fi &&
+ test_stdout_line_count = 2 git ls-files -u &&
test_must_fail git diff --quiet &&
git commit -m "Rename one/file -> two"
'
-if test "$GIT_TEST_MERGE_ALGORITHM" = ort
-then
- test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
- git checkout -q rename-one^0 &&
- mkdir one &&
- test_must_fail git merge --strategy=recursive rename-two &&
-
- test_stdout_line_count = 4 git ls-files -u &&
- test_stdout_line_count = 2 git ls-files -u one &&
- test_stdout_line_count = 2 git ls-files -u two &&
-
- test_must_fail git diff --quiet &&
-
- test 3 -eq $(find . | grep -v .git | wc -l) &&
-
- test_path_is_file one &&
- test_path_is_file two &&
- test "other" = $(cat one) &&
- test "stuff" = $(cat two)
- '
-else
- test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
- git checkout -q rename-one^0 &&
- mkdir one &&
- test_must_fail git merge --strategy=recursive rename-two &&
+test_expect_success 'pair rename to parent of other (D/F conflicts) w/ untracked dir' '
+ git checkout -q rename-one^0 &&
+ mkdir one &&
+ test_must_fail git merge --strategy=recursive rename-two &&
- test_stdout_line_count = 2 git ls-files -u &&
- test_stdout_line_count = 1 git ls-files -u one &&
- test_stdout_line_count = 1 git ls-files -u two &&
+ test_stdout_line_count = 4 git ls-files -u &&
+ test_stdout_line_count = 2 git ls-files -u one &&
+ test_stdout_line_count = 2 git ls-files -u two &&
- test_must_fail git diff --quiet &&
+ test_must_fail git diff --quiet &&
- test 4 -eq $(find . | grep -v .git | wc -l) &&
+ test 3 -eq $(find . | grep -v .git | wc -l) &&
- test_path_is_dir one &&
- test_path_is_file one~rename-two &&
- test_path_is_file two &&
- test "other" = $(cat one~rename-two) &&
- test "stuff" = $(cat two)
- '
-fi
+ test_path_is_file one &&
+ test_path_is_file two &&
+ test "other" = $(cat one) &&
+ test "stuff" = $(cat two)
+'
test_expect_success 'pair rename to parent of other (D/F conflicts) w/ clean start' '
git reset --hard &&
git clean -fdqx &&
test_must_fail git merge --strategy=recursive rename-two &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 4 git ls-files -u &&
- test_stdout_line_count = 2 git ls-files -u one &&
- test_stdout_line_count = 2 git ls-files -u two
- else
- test_stdout_line_count = 2 git ls-files -u &&
- test_stdout_line_count = 1 git ls-files -u one &&
- test_stdout_line_count = 1 git ls-files -u two
- fi &&
+ test_stdout_line_count = 4 git ls-files -u &&
+ test_stdout_line_count = 2 git ls-files -u one &&
+ test_stdout_line_count = 2 git ls-files -u two &&
test_must_fail git diff --quiet &&
git checkout -q first-rename^0 &&
test_must_fail git merge --strategy=recursive second-rename &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_stdout_line_count = 5 git ls-files -s &&
- test_stdout_line_count = 3 git ls-files -u &&
- test_stdout_line_count = 1 git ls-files -u one~HEAD &&
- test_stdout_line_count = 1 git ls-files -u two~second-rename &&
- test_stdout_line_count = 1 git ls-files -u original &&
- test_stdout_line_count = 0 git ls-files -o
- else
- test_stdout_line_count = 5 git ls-files -s &&
- test_stdout_line_count = 3 git ls-files -u &&
- test_stdout_line_count = 1 git ls-files -u one &&
- test_stdout_line_count = 1 git ls-files -u two &&
- test_stdout_line_count = 1 git ls-files -u original &&
- test_stdout_line_count = 2 git ls-files -o
- fi &&
+ test_stdout_line_count = 5 git ls-files -s &&
+ test_stdout_line_count = 3 git ls-files -u &&
+ test_stdout_line_count = 1 git ls-files -u one~HEAD &&
+ test_stdout_line_count = 1 git ls-files -u two~second-rename &&
+ test_stdout_line_count = 1 git ls-files -u original &&
+ test_stdout_line_count = 0 git ls-files -o &&
test_path_is_file one/file &&
test_path_is_file two/file &&
printf "\0\0" >binary-file &&
git add binary-file &&
git commit -m binary2 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge F >merge_output
- else
- test_must_fail git merge F 2>merge_output
- fi &&
+ test_must_fail git merge F >merge_output &&
grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge_output
'
test_tick &&
git commit -m rename &&
test_must_fail git merge delete &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test 2 = $(git ls-files --unmerged | wc -l)
- else
- test 1 = $(git ls-files --unmerged | wc -l)
- fi &&
+ test 2 = $(git ls-files --unmerged | wc -l) &&
git rev-parse --verify :2:a2 &&
test_must_fail git rev-parse --verify :3:a2 &&
git checkout -f delete &&
test_must_fail git merge rename &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test 2 = $(git ls-files --unmerged | wc -l)
- else
- test 1 = $(git ls-files --unmerged | wc -l)
- fi &&
+ test 2 = $(git ls-files --unmerged | wc -l) &&
test_must_fail git rev-parse --verify :2:a2 &&
git rev-parse --verify :3:a2
'
printf "two\0" >bin.txt &&
git commit -am two &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge bin-main >output
- else
- test_must_fail git merge bin-main 2>output
- fi &&
+ test_must_fail git merge bin-main >output &&
grep -i "warning.*cannot merge.*HEAD vs. bin-main" output
'
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
#
# L1 L2
git checkout B^0 &&
test_must_fail git merge C^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git rm -rf a/ &&
- git rm a~HEAD
- else
- git clean -fd &&
- git rm -rf a/ &&
- git rm a
- fi &&
+ git rm -rf a/ &&
+ git rm a~HEAD &&
git cat-file -p B:a >a2 &&
git add a2 &&
git commit -m D2 &&
git checkout C^0 &&
test_must_fail git merge B^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git rm a~B^0
- else
- git clean -fd
- fi &&
+ git rm a~B^0 &&
git rm -rf a/ &&
test_write_lines 1 2 3 4 5 6 7 8 >a &&
git add a &&
git checkout C^0 &&
test_must_fail git merge B^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git rm -rf a/ &&
- git rm a~B^0
- else
- git clean -fd &&
- git rm -rf a/ &&
- git rm a
- fi &&
+ git rm -rf a/ &&
+ git rm a~B^0 &&
test_write_lines 1 2 3 4 5 6 7 8 >a2 &&
git add a2 &&
git commit -m E4 &&
test_must_fail git merge -s recursive E1^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- A:ignore-me B:a D1:a &&
- git rev-parse >actual \
- :0:ignore-me :1:a :2:a &&
- test_cmp expect actual
- else
- git ls-files -s >out &&
- test_line_count = 2 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- A:ignore-me B:a &&
- git rev-parse >actual \
- :0:ignore-me :2:a &&
- test_cmp expect actual
- fi
+ git ls-files -s >out &&
+ test_line_count = 3 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >expect A:ignore-me B:a D1:a &&
+ git rev-parse >actual :0:ignore-me :1:a :2:a &&
+ test_cmp expect actual
)
'
test_must_fail git merge -s recursive D1^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- A:ignore-me B:a D1:a &&
- git rev-parse >actual \
- :0:ignore-me :1:a :3:a &&
- test_cmp expect actual
- else
- git ls-files -s >out &&
- test_line_count = 2 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- A:ignore-me B:a &&
- git rev-parse >actual \
- :0:ignore-me :3:a &&
- test_cmp expect actual
- fi
+ git ls-files -s >out &&
+ test_line_count = 3 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >expect \
+ A:ignore-me B:a D1:a &&
+ git rev-parse >actual \
+ :0:ignore-me :1:a :3:a &&
+ test_cmp expect actual
)
'
test_must_fail git merge -s recursive E2^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 5 out &&
- git ls-files -u >out &&
- test_line_count = 4 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- B:a D1:a E2:a/file C:a/file A:ignore-me &&
- git rev-parse >actual \
- :1:a~HEAD :2:a~HEAD :3:a/file :1:a/file :0:ignore-me
- else
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 3 out &&
- git ls-files -o >out &&
- test_line_count = 2 out &&
-
- git rev-parse >expect \
- B:a E2:a/file C:a/file A:ignore-me &&
- git rev-parse >actual \
- :2:a :3:a/file :1:a/file :0:ignore-me
- fi &&
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+ git ls-files -u >out &&
+ test_line_count = 4 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >expect \
+ B:a D1:a E2:a/file C:a/file A:ignore-me &&
+ git rev-parse >actual \
+ :1:a~HEAD :2:a~HEAD :3:a/file :1:a/file :0:ignore-me &&
test_cmp expect actual &&
test_path_is_file a~HEAD
test_must_fail git merge -s recursive D1^0 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 5 out &&
- git ls-files -u >out &&
- test_line_count = 4 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >expect \
- B:a D1:a E2:a/file C:a/file A:ignore-me &&
- git rev-parse >actual \
- :1:a~D1^0 :3:a~D1^0 :2:a/file :1:a/file :0:ignore-me
- else
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 3 out &&
- git ls-files -o >out &&
- test_line_count = 2 out &&
-
- git rev-parse >expect \
- B:a E2:a/file C:a/file A:ignore-me &&
- git rev-parse >actual \
- :3:a :2:a/file :1:a/file :0:ignore-me
- fi &&
+ git ls-files -s >out &&
+ test_line_count = 5 out &&
+ git ls-files -u >out &&
+ test_line_count = 4 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >expect \
+ B:a D1:a E2:a/file C:a/file A:ignore-me &&
+ git rev-parse >actual \
+ :1:a~D1^0 :3:a~D1^0 :2:a/file :1:a/file :0:ignore-me &&
test_cmp expect actual &&
test_path_is_file a~D1^0
)
'
-test_expect_merge_algorithm failure success 'merge of D1 & E4 puts merge of a and a2 in both a and a2' '
+test_expect_success 'merge of D1 & E4 puts merge of a and a2 in both a and a2' '
test_when_finished "git -C directory-file reset --hard" &&
test_when_finished "git -C directory-file clean -fdqx" &&
(
)
'
-test_expect_merge_algorithm failure success 'check symlink modify/modify' '
+test_expect_success 'check symlink modify/modify' '
(
cd symlink-modify-modify &&
)
'
-test_expect_merge_algorithm failure success 'check symlink add/add' '
+test_expect_success 'check symlink add/add' '
(
cd symlink-add-add &&
)
'
-test_expect_merge_algorithm failure success 'check submodule modify/modify' '
+test_expect_success 'check submodule modify/modify' '
(
cd submodule-modify-modify &&
)
'
-test_expect_merge_algorithm failure success 'check submodule add/add' '
+test_expect_success 'check submodule add/add' '
(
cd submodule-add-add &&
)
'
-test_expect_merge_algorithm failure success 'check conflicting entry types (submodule vs symlink)' '
+test_expect_success 'check conflicting entry types (submodule vs symlink)' '
(
cd submodule-symlink-add-add &&
# files that might be renamed into each other's paths.)
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
test_setup_repo () {
test -d server && return
#
# Summary: 2 fetches (1 for 2 objects, 1 for 1 object)
#
-test_expect_merge_algorithm failure success 'Objects downloaded for single relevant rename' '
+test_expect_success 'Objects downloaded for single relevant rename' '
test_setup_repo &&
git clone --sparse --filter=blob:none "file://$(pwd)/server" objects-single &&
(
# this are not all that common.)
# Summary: 1 fetches for 6 objects
#
-test_expect_merge_algorithm failure success 'Objects downloaded when a directory rename triggered' '
+test_expect_success 'Objects downloaded when a directory rename triggered' '
test_setup_repo &&
git clone --sparse --filter=blob:none "file://$(pwd)/server" objects-dir &&
(
#
# Summary: 4 fetches (1 for 6 objects, 1 for 8, 1 for 3, 1 for 2)
#
-test_expect_merge_algorithm failure success 'Objects downloaded with lots of renames and modifications' '
+test_expect_success 'Objects downloaded with lots of renames and modifications' '
test_setup_repo &&
git clone --sparse --filter=blob:none "file://$(pwd)/server" objects-many &&
(
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
test_setup_rename_delete_untracked () {
git init rename-delete-untracked &&
git ls-files -u >out &&
test_line_count = 1 out &&
git ls-files -o >out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_line_count = 1 out
- else
- test_line_count = 2 out
- fi &&
+ test_line_count = 1 out &&
echo 0 >expect &&
git cat-file -p base:file >>expect &&
git ls-files -u >out &&
test_line_count = 3 out &&
git ls-files -o >out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_line_count = 1 out
- else
- test_line_count = 2 out
- fi &&
+ test_line_count = 1 out &&
git cat-file -p left-conflict:newfile >left &&
git cat-file -p base:file >base &&
git rev-parse >expect \
base:file left-conflict:newfile right:file &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git rev-parse >actual \
- :1:newfile~HEAD :2:newfile~HEAD :3:newfile~HEAD
- else
- git rev-parse >actual \
- :1:newfile :2:newfile :3:newfile
- fi &&
+ git rev-parse >actual \
+ :1:newfile~HEAD :2:newfile~HEAD :3:newfile~HEAD &&
test_cmp expect actual &&
test_path_is_file newfile/realfile &&
)
}
-test_expect_merge_algorithm failure success 'rad-check: rename/add/delete conflict' '
+test_expect_success 'rad-check: rename/add/delete conflict' '
test_setup_rad &&
(
cd rad &&
)
}
-test_expect_merge_algorithm failure success 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
+test_expect_success 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
test_setup_rrdd &&
(
cd rrdd &&
)
}
-test_expect_merge_algorithm failure success 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
+test_expect_success 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
test_setup_mod6 &&
(
cd mod6 &&
# files that might be renamed into each other's paths.)
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
-
###########################################################################
# SECTION 1: Basic cases we should be able to handle
git cat-file -p :2:x/wham >expect &&
git cat-file -p :3:x/wham >other &&
>empty &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge-file \
- -L "HEAD:y/wham" \
- -L "" \
- -L "B^0:z/wham" \
- expect empty other
- else
- test_must_fail git merge-file \
- -L "HEAD" \
- -L "" \
- -L "B^0" \
- expect empty other
- fi &&
+ test_must_fail git merge-file \
+ -L "HEAD:y/wham" \
+ -L "" \
+ -L "B^0:z/wham" \
+ expect empty other &&
test_cmp expect x/wham
)
'
git ls-files -u >out &&
test_line_count = 1 out &&
git ls-files -o >out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d~HEAD :0:y/d/e
- else
- test_line_count = 2 out &&
-
- git rev-parse >actual \
- :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d :0:y/d/e
- fi &&
+ test_line_count = 1 out &&
+
+ git rev-parse >actual \
+ :0:y/b :0:y/c :0:z/d :0:y/f :2:y/d~HEAD :0:y/d/e &&
git rev-parse >expect \
O:z/b O:z/c B:z/d B:z/f A:y/d B:y/d/e &&
test_cmp expect actual &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
test_grep "CONFLICT (rename/delete).*z/c.*y/c" out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:y/b :1:y/c :3:y/c &&
- git rev-parse >expect \
- O:z/b O:z/c O:z/c
- else
- git ls-files -s >out &&
- test_line_count = 2 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:y/b :3:y/c &&
- git rev-parse >expect \
- O:z/b O:z/c
- fi &&
+ git ls-files -s >out &&
+ test_line_count = 3 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >actual \
+ :0:y/b :1:y/c :3:y/c &&
+ git rev-parse >expect \
+ O:z/b O:z/c O:z/c &&
test_cmp expect actual
)
'
)
}
-test_expect_merge_algorithm failure success '6b1: Same renames done on both sides, plus another rename' '
+test_expect_success '6b1: Same renames done on both sides, plus another rename' '
test_setup_6b1 &&
(
cd 6b1 &&
)
}
-test_expect_merge_algorithm failure success '6b2: Same rename done on both sides' '
+test_expect_success '6b2: Same rename done on both sides' '
test_setup_6b2 &&
(
cd 6b2 &&
git cat-file -p :2:y/d >expect &&
git cat-file -p :3:y/d >other &&
>empty &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge-file \
- -L "HEAD:y/d" \
- -L "" \
- -L "B^0:z/d" \
- expect empty other
- else
- test_must_fail git merge-file \
- -L "HEAD" \
- -L "" \
- -L "B^0" \
- expect empty other
- fi &&
+ test_must_fail git merge-file \
+ -L "HEAD:y/d" \
+ -L "" \
+ -L "B^0:z/d" \
+ expect empty other &&
test_cmp expect y/d
)
'
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
test_grep "CONFLICT (rename/delete).*x/d.*y/d" out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:y/b :0:y/c :1:y/d :3:y/d &&
- git rev-parse >expect \
- O:z/b O:z/c O:x/d O:x/d
- else
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:y/b :0:y/c :3:y/d &&
- git rev-parse >expect \
- O:z/b O:z/c O:x/d
- fi &&
+ git ls-files -s >out &&
+ test_line_count = 4 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >actual \
+ :0:y/b :0:y/c :1:y/d :3:y/d &&
+ git rev-parse >expect \
+ O:z/b O:z/c O:x/d O:x/d &&
test_cmp expect actual
)
'
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
test_grep "CONFLICT (rename/delete).*x/d.*y/d" out &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git ls-files -s >out &&
- test_line_count = 6 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 1 out &&
-
- git rev-parse >actual \
- :0:x/d/f :0:y/d/g :0:y/b :0:y/c :1:y/d~B^0 :3:y/d~B^0 &&
- git rev-parse >expect \
- A:x/d/f A:y/d/g O:z/b O:z/c O:x/d O:x/d
- else
- git ls-files -s >out &&
- test_line_count = 5 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 2 out &&
-
- git rev-parse >actual \
- :0:x/d/f :0:y/d/g :0:y/b :0:y/c :3:y/d &&
- git rev-parse >expect \
- A:x/d/f A:y/d/g O:z/b O:z/c O:x/d
- fi &&
+ git ls-files -s >out &&
+ test_line_count = 6 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out &&
+
+ git rev-parse >actual \
+ :0:x/d/f :0:y/d/g :0:y/b :0:y/c :1:y/d~B^0 :3:y/d~B^0 &&
+ git rev-parse >expect \
+ A:x/d/f A:y/d/g O:z/b O:z/c O:x/d O:x/d &&
test_cmp expect actual &&
git hash-object y/d~B^0 >actual &&
echo contents >y/e &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
-
- git ls-files -s >out &&
- test_line_count = 1 out &&
- git ls-files -u >out &&
- test_line_count = 0 out &&
- git ls-files -o >out &&
- test_line_count = 5 out
- else
- test_grep "CONFLICT (rename/delete).*Version B\^0 of y/d left in tree at y/d~B\^0" out &&
- test_grep "Error: Refusing to lose untracked file at y/e; writing to y/e~B\^0 instead" out &&
-
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 5 out &&
-
- git rev-parse >actual \
- :0:y/b :3:y/d :3:y/e &&
- git rev-parse >expect \
- O:z/b O:z/c B:z/e &&
- test_cmp expect actual
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
+
+ git ls-files -s >out &&
+ test_line_count = 1 out &&
+ git ls-files -u >out &&
+ test_line_count = 0 out &&
+ git ls-files -o >out &&
+ test_line_count = 5 out &&
echo very >expect &&
test_cmp expect y/c &&
echo important >y/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
-
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 0 out &&
- git ls-files -o >out &&
- test_line_count = 3 out
- else
- test_grep "CONFLICT (rename/rename)" out &&
- test_grep "Refusing to lose untracked file at y/c; adding as y/c~B\^0 instead" out &&
-
- git ls-files -s >out &&
- test_line_count = 6 out &&
- git ls-files -u >out &&
- test_line_count = 3 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :3:y/c &&
- git rev-parse >expect \
- O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c &&
- test_cmp expect actual &&
-
- git hash-object y/c~B^0 >actual &&
- git rev-parse O:x/c >expect &&
- test_cmp expect actual
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
+
+ git ls-files -s >out &&
+ test_line_count = 4 out &&
+ git ls-files -u >out &&
+ test_line_count = 0 out &&
+ git ls-files -o >out &&
+ test_line_count = 3 out &&
echo important >expect &&
test_cmp expect y/c
echo important >y/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive A^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
-
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 0 out &&
- git ls-files -o >out &&
- test_line_count = 3 out
- else
- test_grep "CONFLICT (rename/rename)" out &&
- test_grep "Refusing to lose untracked file at y/c; adding as y/c~HEAD instead" out &&
-
- git ls-files -s >out &&
- test_line_count = 6 out &&
- git ls-files -u >out &&
- test_line_count = 3 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:y/a :0:y/b :0:x/d :1:x/c :3:w/c :2:y/c &&
- git rev-parse >expect \
- O:z/a O:z/b O:x/d O:x/c O:x/c O:x/c &&
- test_cmp expect actual &&
-
- git hash-object y/c~HEAD >actual &&
- git rev-parse O:x/c >expect &&
- test_cmp expect actual
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
+
+ git ls-files -s >out &&
+ test_line_count = 4 out &&
+ git ls-files -u >out &&
+ test_line_count = 0 out &&
+ git ls-files -o >out &&
+ test_line_count = 3 out &&
echo important >expect &&
test_cmp expect y/c
echo important >y/wham &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
-
- git ls-files -s >out &&
- test_line_count = 6 out &&
- git ls-files -u >out &&
- test_line_count = 0 out &&
- git ls-files -o >out &&
- test_line_count = 3 out
- else
- test_grep "CONFLICT (rename/rename)" out &&
- test_grep "Refusing to lose untracked file at y/wham" out &&
-
- git ls-files -s >out &&
- test_line_count = 6 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:y/a :0:y/b :0:y/d :0:y/e :2:y/wham :3:y/wham &&
- git rev-parse >expect \
- O:z/a O:z/b O:x/d O:x/e O:z/c O:x/f &&
- test_cmp expect actual &&
-
- test_must_fail git rev-parse :1:y/wham &&
-
- # Test that two-way merge in y/wham~merged is as expected
- git cat-file -p :2:y/wham >expect &&
- git cat-file -p :3:y/wham >other &&
- >empty &&
- test_must_fail git merge-file \
- -L "HEAD" \
- -L "" \
- -L "B^0" \
- expect empty other &&
- test_cmp expect y/wham~merged
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: The following untracked working tree files would be overwritten by merge" err &&
+
+ git ls-files -s >out &&
+ test_line_count = 6 out &&
+ git ls-files -u >out &&
+ test_line_count = 0 out &&
+ git ls-files -o >out &&
+ test_line_count = 3 out &&
echo important >expect &&
test_cmp expect y/wham
)
}
-test_expect_merge_algorithm failure success '10e: Does git complain about untracked file that is not really in the way?' '
+test_expect_success '10e: Does git complain about untracked file that is not really in the way?' '
test_setup_10e &&
(
cd 10e &&
echo stuff >>z/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- test_grep "Refusing to lose dirty file at z/c" out &&
-
- git ls-files -s >out &&
- test_line_count = 2 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:z/a :2:z/c &&
- git rev-parse >expect \
- O:z/a B:z/b &&
- test_cmp expect actual &&
-
- git hash-object z/c~HEAD >actual &&
- git rev-parse B:z/b >expect &&
- test_cmp expect actual
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
test_seq 1 10 >expected &&
echo stuff >>expected &&
git checkout A^0 &&
echo stuff >>z/c &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- test_grep "Refusing to lose dirty file at z/c" out &&
-
- git ls-files -s >out &&
- test_line_count = 3 out &&
- git ls-files -u >out &&
- test_line_count = 0 out &&
- git ls-files -m >out &&
- test_line_count = 0 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:x/b :0:y/a :0:y/c &&
- git rev-parse >expect \
- O:x/b O:z/a B:x/c &&
- test_cmp expect actual &&
-
- git hash-object y/c >actual &&
- git rev-parse B:x/c >expect &&
- test_cmp expect actual
- fi &&
+ test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
grep -q stuff z/c &&
test_seq 1 10 >expected &&
echo stuff >>y/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- test_grep "following files would be overwritten by merge" err
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
grep -q stuff y/c &&
test_seq 1 10 >expected &&
echo stuff >>z/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- test_grep "Refusing to lose dirty file at z/c" out &&
-
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 1 out &&
- git ls-files -o >out &&
- test_line_count = 4 out &&
-
- git rev-parse >actual \
- :0:x/b :0:y/a :0:y/c/d :3:y/c &&
- git rev-parse >expect \
- O:x/b O:z/a B:y/c/d B:x/c &&
- test_cmp expect actual &&
-
- git hash-object y/c~HEAD >actual &&
- git rev-parse B:x/c >expect &&
- test_cmp expect actual
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
grep -q stuff z/c &&
test_seq 1 10 >expected &&
echo mods >>y/c &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- test_grep "CONFLICT (rename/rename)" out &&
- test_grep "Refusing to lose dirty file at y/c" out &&
-
- git ls-files -s >out &&
- test_line_count = 7 out &&
- git ls-files -u >out &&
- test_line_count = 4 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- git rev-parse >actual \
- :0:y/a :0:y/b :0:x/d :1:x/c :2:w/c :2:y/c :3:y/c &&
- git rev-parse >expect \
- O:z/a O:z/b O:x/d O:x/c O:x/c A:y/c O:x/c &&
- test_cmp expect actual &&
-
- # See if y/c~merged has expected contents; requires manually
- # doing the expected file merge
- git cat-file -p A:y/c >c1 &&
- git cat-file -p B:z/c >c2 &&
- >empty &&
- test_must_fail git merge-file \
- -L "HEAD" \
- -L "" \
- -L "B^0" \
- c1 empty c2 &&
- test_cmp c1 y/c~merged
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
echo different >expected &&
echo mods >>expected &&
echo important >>y/wham &&
test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_path_is_missing .git/MERGE_HEAD &&
- test_grep "error: Your local changes to the following files would be overwritten by merge" err
- else
- test_grep "CONFLICT (rename/rename)" out &&
- test_grep "Refusing to lose dirty file at y/wham" out &&
-
- git ls-files -s >out &&
- test_line_count = 4 out &&
- git ls-files -u >out &&
- test_line_count = 2 out &&
- git ls-files -o >out &&
- test_line_count = 3 out &&
-
- test_must_fail git rev-parse :1:y/wham &&
-
- git rev-parse >actual \
- :0:y/a :0:y/b :2:y/wham :3:y/wham &&
- git rev-parse >expect \
- O:z/a O:z/b O:x/c O:x/d &&
- test_cmp expect actual &&
-
- # Test that two-way merge in y/wham~merged is as expected
- git cat-file -p :2:y/wham >expect &&
- git cat-file -p :3:y/wham >other &&
- >empty &&
- test_must_fail git merge-file \
- -L "HEAD" \
- -L "" \
- -L "B^0" \
- expect empty other &&
- test_cmp expect y/wham~merged
- fi &&
+ test_path_is_missing .git/MERGE_HEAD &&
+ test_grep "error: Your local changes to the following files would be overwritten by merge" err &&
test_seq 1 10 >expected &&
echo important >>expected &&
)
}
-test_expect_merge_algorithm failure success '12b1: Moving two directory hierarchies into each other' '
+test_expect_success '12b1: Moving two directory hierarchies into each other' '
test_setup_12b1 &&
(
cd 12b1 &&
)
}
-test_expect_merge_algorithm failure success '12c1: Moving one directory hierarchy into another w/ content merge' '
+test_expect_success '12c1: Moving one directory hierarchy into another w/ content merge' '
test_setup_12c1 &&
(
cd 12c1 &&
)
}
-test_expect_merge_algorithm failure success '12f: Trivial directory resolve, caching, all kinds of fun' '
+test_expect_success '12f: Trivial directory resolve, caching, all kinds of fun' '
test_setup_12f &&
(
cd 12f &&
)
}
-test_expect_merge_algorithm failure success '12l (B into A): Rename into each other + add/add conflict' '
+test_expect_success '12l (B into A): Rename into each other + add/add conflict' '
test_setup_12l BintoA &&
(
cd 12l_BintoA &&
)
'
-test_expect_merge_algorithm failure success '12l (A into B): Rename into each other + add/add conflict' '
+test_expect_success '12l (A into B): Rename into each other + add/add conflict' '
test_setup_12l AintoB &&
(
cd 12l_AintoB &&
)
}
-test_expect_merge_algorithm failure success '12m: Change parent of renamed-dir to symlink on other side' '
+test_expect_success '12m: Change parent of renamed-dir to symlink on other side' '
test_setup_12m &&
(
cd 12m &&
git add a &&
git rev-parse :a >expect &&
- sane_unset GIT_TEST_MERGE_ALGORITHM &&
- test_must_fail git merge -s recursive -s ort -s octopus C^0 >output 2>&1 &&
+ test_must_fail git merge -s ort -s octopus C^0 >output 2>&1 &&
- grep "Trying merge strategy recursive..." output &&
grep "Trying merge strategy ort..." output &&
grep "Trying merge strategy octopus..." output &&
grep "No merge strategy handled the merge." output &&
# files that might be renamed into each other's paths.)
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
-
###########################################################################
# SECTION 1: Cases involving no renames (one side has subset of changes of
# correct requires doing the merge in-memory first, then realizing that no
# updates to the file are necessary, and thus that we can just leave the path
# alone.
-test_expect_merge_algorithm failure success '4a: Change on A, change on B subset of A, dirty mods present' '
+test_expect_success '4a: Change on A, change on B subset of A, dirty mods present' '
test_setup_4a &&
(
cd 4a &&
# files that might be renamed into each other's paths.)
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
-
# Testcase basic, conflicting changes in 'numerals'
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
test_expect_success 'setup 1' '
test_cmp expected actual
'
-test_expect_merge_algorithm failure success 'merge-recursive rename vs. rename/symlink' '
+test_expect_success 'merge-recursive rename vs. rename/symlink' '
git checkout -f rename &&
git merge rename-ln &&
git mv c1.c other.c &&
git commit -m rename &&
cp important other.c &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge c1a >out 2>err &&
- test_grep "would be overwritten by merge" err &&
- test_cmp important other.c &&
- test_path_is_missing .git/MERGE_HEAD
- else
- test_must_fail git merge c1a >out &&
- test_grep "Refusing to lose dirty file at other.c" out &&
- test_path_is_file other.c~HEAD &&
- test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) &&
- test_cmp important other.c
- fi
+ test_must_fail git merge c1a >out 2>err &&
+ test_grep "would be overwritten by merge" err &&
+ test_cmp important other.c &&
+ test_path_is_missing .git/MERGE_HEAD
'
test_expect_success 'will not overwrite untracked subtree' '
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
. ./test-lib.sh
-. "$TEST_DIRECTORY"/lib-merge.sh
#
# history
test_when_finished "git -C merge-search reset --hard" &&
(cd merge-search &&
git checkout -b test-nonforward-a b &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge c 2>actual &&
- sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
- grep "$sub_expect" actual
- else
- test_must_fail git merge c 2> actual
- fi)
+ test_must_fail git merge c 2>actual &&
+ sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
+ grep "$sub_expect" actual
+ )
'
test_expect_success 'finish setup for merge-search' '
git checkout -b test-nonforward-b b &&
(cd sub &&
git rev-parse --short sub-d > ../expect) &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge c >actual 2>sub-actual &&
- sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
- grep "$sub_expect" sub-actual
- else
- test_must_fail git merge c 2> actual
- fi &&
+ test_must_fail git merge c >actual 2>sub-actual &&
+ sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
+ grep "$sub_expect" sub-actual &&
grep $(cat expect) actual > /dev/null &&
git reset --hard)
'
(cd sub &&
git checkout -b ambiguous sub-b &&
git merge sub-c &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- git rev-parse --short sub-d >../expect1 &&
- git rev-parse --short ambiguous >../expect2
- else
- git rev-parse sub-d > ../expect1 &&
- git rev-parse ambiguous > ../expect2
- fi
+ git rev-parse --short sub-d >../expect1 &&
+ git rev-parse --short ambiguous >../expect2
) &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- test_must_fail git merge c >actual 2>sub-actual &&
- sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
- grep "$sub_expect" sub-actual
- else
- test_must_fail git merge c 2> actual
- fi &&
+ test_must_fail git merge c >actual 2>sub-actual &&
+ sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
+ grep "$sub_expect" sub-actual &&
grep $(cat expect1) actual > /dev/null &&
grep $(cat expect2) actual > /dev/null &&
git reset --hard)
git checkout -b test-backward e &&
test_must_fail git merge f 2>actual &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-d)" &&
- grep "$sub_expect" actual
- fi)
+ sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-d)" &&
+ grep "$sub_expect" actual
+ )
'
)
'
-test_expect_merge_algorithm failure success 'file/submodule conflict' '
+test_expect_success 'file/submodule conflict' '
test_when_finished "git -C file-submodule reset --hard" &&
(
cd file-submodule &&
)
'
-test_expect_merge_algorithm failure success !FAIL_PREREQS 'directory/submodule conflict; should not treat submodule files as untracked or in the way' '
+test_expect_success !FAIL_PREREQS 'directory/submodule conflict; should not treat submodule files as untracked or in the way' '
test_when_finished "git -C directory-submodule/path reset --hard" &&
test_when_finished "git -C directory-submodule reset --hard" &&
(
git add sub &&
git commit -m "b" &&
test_must_fail git merge a 2>actual &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short HEAD^1)" &&
- grep "$sub_expect" actual
- fi)
+ sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short HEAD^1)" &&
+ grep "$sub_expect" actual
+ )
'
test_done
test_submodule_switch "merge --ff-only"
-if test "$GIT_TEST_MERGE_ALGORITHM" != ort
-then
- KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
- KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
-fi
test_submodule_switch "merge --no-ff"
test_done
export GIT_MERGE_VERBOSITY &&
test_must_fail git merge branch 2>out2
) &&
- echo "Merge with strategy ${GIT_TEST_MERGE_ALGORITHM:-ort} failed." >>expect &&
+ echo "Merge with strategy ort failed." >>expect &&
test_cmp out2 expect &&
git reset --hard HEAD^
'
echo "160000 $(git rev-parse HEAD) 3 submodule"
) >expect &&
test_cmp expect actual &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- sub_expect="go to submodule (submodule), and either merge commit $(git -C submodule rev-parse --short HEAD^0)" &&
- grep "$sub_expect" actual_output
- fi
+ sub_expect="go to submodule (submodule), and either merge commit $(git -C submodule rev-parse --short HEAD^0)" &&
+ grep "$sub_expect" actual_output
'
test_done
EOF
test_expect_success 'merge reduces irrelevant remote heads' '
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- mv expected expected.tmp &&
- sed s/recursive/ort/ expected.tmp >expected &&
- rm expected.tmp
- fi &&
+ mv expected expected.tmp &&
+ sed s/recursive/ort/ expected.tmp >expected &&
+ rm expected.tmp &&
GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
test_cmp expected actual
'
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "d" | git mergetool file11 file12 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- yes "c" | git mergetool submod~HEAD &&
- git rm submod &&
- git mv submod~HEAD submod
- else
- yes "l" | git mergetool submod
- fi &&
+ yes "c" | git mergetool submod~HEAD &&
+ git rm submod &&
+ git mv submod~HEAD submod &&
git submodule update -N &&
echo "not a submodule" >expect &&
test_cmp expect submod &&
yes "" | git mergetool file1 file2 spaced\ name subdir/file3 &&
yes "" | git mergetool both &&
yes "d" | git mergetool file11 file12 &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- mv submod submod.orig &&
- git rm --cached submod &&
- yes "c" | git mergetool submod~test19 &&
- git mv submod~test19 submod
- else
- yes "r" | git mergetool submod
- fi &&
+ mv submod submod.orig &&
+ git rm --cached submod &&
+ yes "c" | git mergetool submod~test19 &&
+ git mv submod~test19 submod &&
test -d submod.orig &&
git submodule update -N &&
echo "not a submodule" >expect &&
yes "" | git mergetool both &&
yes "d" | git mergetool file11 file12 &&
yes "l" | git mergetool submod &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- yes "d" | git mergetool submod~test19
- fi &&
+ yes "d" | git mergetool submod~test19 &&
echo "main submodule" >expect &&
test_cmp expect submod/bar &&
git submodule update -N &&
test_must_fail git merge main &&
test -n "$(git ls-files -u)" &&
test ! -e submod.orig &&
- if test "$GIT_TEST_MERGE_ALGORITHM" = ort
- then
- yes "r" | git mergetool submod~main &&
- git mv submod submod.orig &&
- git mv submod~main submod
- else
- yes "r" | git mergetool submod
- fi &&
+ yes "r" | git mergetool submod~main &&
+ git mv submod submod.orig &&
+ git mv submod~main submod &&
test -d submod.orig &&
echo "not a submodule" >expect &&
test_cmp expect submod.orig/file16 &&
export GIT_DEFAULT_HASH
GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
export GIT_DEFAULT_REF_FORMAT
-GIT_TEST_MERGE_ALGORITHM="${GIT_TEST_MERGE_ALGORITHM:-ort}"
-export GIT_TEST_MERGE_ALGORITHM
# Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
GIT_TRACE_BARE=1