mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'en/merge-ort-renorm-with-rename-delete-conflict-fix'
A corner case bug in the ort merge strategy has been corrected. * en/merge-ort-renorm-with-rename-delete-conflict-fix: merge-ort: fix bug with renormalization and rename/delete conflicts
This commit is contained in:
commit
2c5410480e
19
merge-ort.c
19
merge-ort.c
|
@ -3841,9 +3841,22 @@ static void process_entry(struct merge_options *opt,
|
||||||
if (opt->renormalize &&
|
if (opt->renormalize &&
|
||||||
blob_unchanged(opt, &ci->stages[0], &ci->stages[side],
|
blob_unchanged(opt, &ci->stages[0], &ci->stages[side],
|
||||||
path)) {
|
path)) {
|
||||||
ci->merged.is_null = 1;
|
if (!ci->path_conflict) {
|
||||||
ci->merged.clean = 1;
|
/*
|
||||||
assert(!ci->df_conflict && !ci->path_conflict);
|
* Blob unchanged after renormalization, so
|
||||||
|
* there's no modify/delete conflict after all;
|
||||||
|
* we can just remove the file.
|
||||||
|
*/
|
||||||
|
ci->merged.is_null = 1;
|
||||||
|
ci->merged.clean = 1;
|
||||||
|
/*
|
||||||
|
* file goes away => even if there was a
|
||||||
|
* directory/file conflict there isn't one now.
|
||||||
|
*/
|
||||||
|
ci->df_conflict = 0;
|
||||||
|
} else {
|
||||||
|
/* rename/delete, so conflict remains */
|
||||||
|
}
|
||||||
} else if (ci->path_conflict &&
|
} else if (ci->path_conflict &&
|
||||||
oideq(&ci->stages[0].oid, &ci->stages[side].oid)) {
|
oideq(&ci->stages[0].oid, &ci->stages[side].oid)) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -204,4 +204,30 @@ test_expect_success 'Test delete/normalize conflict' '
|
||||||
test_path_is_missing file
|
test_path_is_missing file
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'rename/delete vs. renormalization' '
|
||||||
|
git init subrepo &&
|
||||||
|
(
|
||||||
|
cd subrepo &&
|
||||||
|
echo foo >oldfile &&
|
||||||
|
git add oldfile &&
|
||||||
|
git commit -m original &&
|
||||||
|
|
||||||
|
git branch rename &&
|
||||||
|
git branch nuke &&
|
||||||
|
|
||||||
|
git checkout rename &&
|
||||||
|
git mv oldfile newfile &&
|
||||||
|
git commit -m renamed &&
|
||||||
|
|
||||||
|
git checkout nuke &&
|
||||||
|
git rm oldfile &&
|
||||||
|
git commit -m deleted &&
|
||||||
|
|
||||||
|
git checkout rename^0 &&
|
||||||
|
test_must_fail git -c merge.renormalize=true merge nuke >out &&
|
||||||
|
|
||||||
|
grep "rename/delete" out
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue