@@ -3,7 +3,7 @@
#include "advice.h"
#include "gettext.h"
#include "hash.h"
-#include "merge-recursive.h"
+#include "merge-ort-wrappers.h"
#include "object-name.h"
static const char builtin_merge_recursive_usage[] =
@@ -89,7 +89,7 @@ int cmd_merge_recursive(int argc,
if (o.verbosity >= 3)
printf(_("Merging %s with %s\n"), o.branch1, o.branch2);
- failed = merge_recursive_generic(&o, &h1, &h2, bases_count, bases, &result);
+ failed = merge_ort_generic(&o, &h1, &h2, bases_count, bases, &result);
free(better1);
free(better2);
@@ -176,9 +176,11 @@ test_expect_success 'merge-recursive, when index==head but head!=HEAD' '
# Make index match B
git diff C B -- | git apply --cached &&
test_when_finished "git clean -fd" && # Do not leave untracked around
+ git write-tree >index-before &&
# Merge B & F, with B as "head"
git merge-recursive A -- B F > out &&
- test_grep "Already up to date" out
+ git write-tree >index-after &&
+ test_cmp index-before index-after
'
test_expect_success 'recursive, when file has staged changes not matching HEAD nor what a merge would give' '
@@ -373,9 +373,9 @@ test_expect_success 'merge-recursive d/f conflict result' '
git ls-files -s >actual &&
(
- echo "100644 $o0 1 a" &&
- echo "100644 $o1 2 a" &&
echo "100644 $o4 0 a/c" &&
+ echo "100644 $o0 1 a~$c1" &&
+ echo "100644 $o1 2 a~$c1" &&
echo "100644 $o0 0 b" &&
echo "100644 $o0 0 c" &&
echo "100644 $o1 0 d/e"
@@ -397,9 +397,9 @@ test_expect_success 'merge-recursive d/f conflict result the other way' '
git ls-files -s >actual &&
(
- echo "100644 $o0 1 a" &&
- echo "100644 $o1 3 a" &&
echo "100644 $o4 0 a/c" &&
+ echo "100644 $o0 1 a~$c1" &&
+ echo "100644 $o1 3 a~$c1" &&
echo "100644 $o0 0 b" &&
echo "100644 $o0 0 c" &&
echo "100644 $o1 0 d/e"
@@ -424,9 +424,9 @@ test_expect_success 'merge-recursive d/f conflict result' '
echo "100644 $o1 0 a" &&
echo "100644 $o0 0 b" &&
echo "100644 $o0 0 c" &&
- echo "100644 $o6 3 d" &&
echo "100644 $o0 1 d/e" &&
- echo "100644 $o1 2 d/e"
+ echo "100644 $o1 2 d/e" &&
+ echo "100644 $o6 3 d~$c6"
) >expected &&
test_cmp expected actual
@@ -448,9 +448,9 @@ test_expect_success 'merge-recursive d/f conflict result' '
echo "100644 $o1 0 a" &&
echo "100644 $o0 0 b" &&
echo "100644 $o0 0 c" &&
- echo "100644 $o6 2 d" &&
echo "100644 $o0 1 d/e" &&
- echo "100644 $o1 3 d/e"
+ echo "100644 $o1 3 d/e" &&
+ echo "100644 $o6 2 d~$c6"
) >expected &&
test_cmp expected actual
@@ -696,33 +696,6 @@ test_expect_success 'merging with triple rename across D/F conflict' '
git merge other
'
-test_expect_success 'merge-recursive remembers the names of all base trees' '
- git reset --hard HEAD &&
-
- # make the index match $c1 so that merge-recursive below does not
- # fail early
- git diff --binary HEAD $c1 -- | git apply --cached &&
-
- # more trees than static slots used by oid_to_hex()
- for commit in $c0 $c2 $c4 $c5 $c6 $c7
- do
- git rev-parse "$commit^{tree}" || return 1
- done >trees &&
-
- # ignore the return code; it only fails because the input is weird...
- test_must_fail git -c merge.verbosity=5 merge-recursive $(cat trees) -- $c1 $c3 >out &&
-
- # ...but make sure it fails in the expected way
- test_grep CONFLICT.*rename/rename out &&
-
- # merge-recursive prints in reverse order, but we do not care
- sort <trees >expect &&
- sed -n "s/^virtual //p" out | sort >actual &&
- test_cmp expect actual &&
-
- git clean -fd
-'
-
test_expect_success 'merge-recursive internal merge resolves to the sameness' '
git reset --hard HEAD &&
@@ -34,7 +34,9 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
get_expected_stages () {
git checkout rename -- $1-new &&
git ls-files --stage $1-new >expected-stages-undetected-$1 &&
- sed "s/ 0 / 2 /" <expected-stages-undetected-$1 \
+ git ls-tree HEAD^ $1-old >tmp &&
+ git ls-tree HEAD $1-new >>tmp &&
+ cat tmp | awk '{print $1 " " $3 " " NR "\t" '$1'"-new"}' \
>expected-stages-detected-$1 &&
git read-tree -u --reset HEAD
}
@@ -51,11 +53,11 @@ rename_undetected () {
check_common () {
git ls-files --stage >stages-actual &&
- test_line_count = 4 stages-actual
+ test_line_count = $1 stages-actual
}
check_threshold_0 () {
- check_common &&
+ check_common 8 &&
rename_detected 0 &&
rename_detected 1 &&
rename_detected 2 &&
@@ -63,7 +65,7 @@ check_threshold_0 () {
}
check_threshold_1 () {
- check_common &&
+ check_common 7 &&
rename_undetected 0 &&
rename_detected 1 &&
rename_detected 2 &&
@@ -71,7 +73,7 @@ check_threshold_1 () {
}
check_threshold_2 () {
- check_common &&
+ check_common 6 &&
rename_undetected 0 &&
rename_undetected 1 &&
rename_detected 2 &&
@@ -79,7 +81,7 @@ check_threshold_2 () {
}
check_exact_renames () {
- check_common &&
+ check_common 5 &&
rename_undetected 0 &&
rename_undetected 1 &&
rename_undetected 2 &&
@@ -87,7 +89,7 @@ check_exact_renames () {
}
check_no_renames () {
- check_common &&
+ check_common 4 &&
rename_undetected 0 &&
rename_undetected 1 &&
rename_undetected 2 &&