зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/ll-merge-internal'
"git rerere" can get confused by conflict markers deliberately left by the inner merge step, because they are indistinguishable from the real conflict markers left by the outermost merge which are what the end user and "rerere" need to look at. This was fixed by making the conflict markers left by the inner merges a bit longer. * jc/ll-merge-internal: t6036: remove pointless test that expects failure ll-merge: use a longer conflict marker for internal merge ll-merge: fix typo in comment
This commit is contained in:
Коммит
243a7f0557
12
ll-merge.c
12
ll-merge.c
|
@ -47,7 +47,9 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
|
|||
assert(opts);
|
||||
|
||||
/*
|
||||
* The tentative merge result is the or common ancestor for an internal merge.
|
||||
* The tentative merge result is the common ancestor for an
|
||||
* internal merge. For the final merge, it is "ours" by
|
||||
* default but -Xours/-Xtheirs can tweak the choice.
|
||||
*/
|
||||
if (opts->virtual_ancestor) {
|
||||
stolen = orig;
|
||||
|
@ -383,8 +385,12 @@ int ll_merge(mmbuffer_t *result_buf,
|
|||
}
|
||||
}
|
||||
driver = find_ll_merge_driver(ll_driver_name);
|
||||
if (opts->virtual_ancestor && driver->recursive)
|
||||
driver = find_ll_merge_driver(driver->recursive);
|
||||
|
||||
if (opts->virtual_ancestor) {
|
||||
if (driver->recursive)
|
||||
driver = find_ll_merge_driver(driver->recursive);
|
||||
marker_size += 2;
|
||||
}
|
||||
return driver->fn(driver, result_buf, path, ancestor, ancestor_label,
|
||||
ours, our_label, theirs, their_label,
|
||||
opts, marker_size);
|
||||
|
|
|
@ -76,7 +76,7 @@ test_expect_success "result contains a conflict" "test_cmp expect a1"
|
|||
|
||||
git ls-files --stage > out
|
||||
cat > expect << EOF
|
||||
100644 439cc46de773d8a83c77799b7cc9191c128bfcff 1 a1
|
||||
100644 ec3fe2a791706733f2d8fa7ad45d9a9672031f5e 1 a1
|
||||
100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1
|
||||
100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
|
||||
EOF
|
||||
|
|
|
@ -212,7 +212,8 @@ test_expect_success 'git detects differently handled merges conflict' '
|
|||
-L "" \
|
||||
-L "Temporary merge branch 1" \
|
||||
merged empty merge-me &&
|
||||
test $(git rev-parse :1:new_a) = $(git hash-object merged)
|
||||
sed -e "s/^\([<=>]\)/\1\1\1/" merged >merged-internal &&
|
||||
test $(git rev-parse :1:new_a) = $(git hash-object merged-internal)
|
||||
'
|
||||
|
||||
#
|
||||
|
@ -298,89 +299,6 @@ test_expect_success 'git detects conflict merging criss-cross+modify/delete, rev
|
|||
test $(git rev-parse :3:file) = $(git rev-parse B:file)
|
||||
'
|
||||
|
||||
#
|
||||
# criss-cross + modify/modify with very contrived file contents:
|
||||
#
|
||||
# B D
|
||||
# o---o
|
||||
# / \ / \
|
||||
# A o X ? F
|
||||
# \ / \ /
|
||||
# o---o
|
||||
# C E
|
||||
#
|
||||
# Commit A: file with contents 'A\n'
|
||||
# Commit B: file with contents 'B\n'
|
||||
# Commit C: file with contents 'C\n'
|
||||
# Commit D: file with contents 'D\n'
|
||||
# Commit E: file with contents:
|
||||
# <<<<<<< Temporary merge branch 1
|
||||
# C
|
||||
# =======
|
||||
# B
|
||||
# >>>>>>> Temporary merge branch 2
|
||||
#
|
||||
# Now, when we merge commits D & E, does git detect the conflict?
|
||||
|
||||
test_expect_success 'setup differently handled merges of content conflict' '
|
||||
git clean -fdqx &&
|
||||
rm -rf .git &&
|
||||
git init &&
|
||||
|
||||
echo A >file &&
|
||||
git add file &&
|
||||
test_tick &&
|
||||
git commit -m A &&
|
||||
|
||||
git branch B &&
|
||||
git checkout -b C &&
|
||||
echo C >file &&
|
||||
git add file &&
|
||||
test_tick &&
|
||||
git commit -m C &&
|
||||
|
||||
git checkout B &&
|
||||
echo B >file &&
|
||||
git add file &&
|
||||
test_tick &&
|
||||
git commit -m B &&
|
||||
|
||||
git checkout B^0 &&
|
||||
test_must_fail git merge C &&
|
||||
echo D >file &&
|
||||
git add file &&
|
||||
test_tick &&
|
||||
git commit -m D &&
|
||||
git tag D &&
|
||||
|
||||
git checkout C^0 &&
|
||||
test_must_fail git merge B &&
|
||||
cat <<EOF >file &&
|
||||
<<<<<<< Temporary merge branch 1
|
||||
C
|
||||
=======
|
||||
B
|
||||
>>>>>>> Temporary merge branch 2
|
||||
EOF
|
||||
git add file &&
|
||||
test_tick &&
|
||||
git commit -m E &&
|
||||
git tag E
|
||||
'
|
||||
|
||||
test_expect_failure 'git detects conflict w/ criss-cross+contrived resolution' '
|
||||
git checkout D^0 &&
|
||||
|
||||
test_must_fail git merge -s recursive E^0 &&
|
||||
|
||||
test 3 -eq $(git ls-files -s | wc -l) &&
|
||||
test 3 -eq $(git ls-files -u | wc -l) &&
|
||||
test 0 -eq $(git ls-files -o | wc -l) &&
|
||||
|
||||
test $(git rev-parse :2:file) = $(git rev-parse D:file) &&
|
||||
test $(git rev-parse :3:file) = $(git rev-parse E:file)
|
||||
'
|
||||
|
||||
#
|
||||
# criss-cross + d/f conflict via add/add:
|
||||
# Commit A: Neither file 'a' nor directory 'a/' exists.
|
||||
|
|
Загрузка…
Ссылка в новой задаче