From: Derrick Stolee <stolee@gmail.com>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Cc: Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH] merge-ort: fix bug with renormalization and rename/delete conflicts
Date: Tue, 28 Dec 2021 08:55:16 -0500 [thread overview]
Message-ID: <78ba0d99-246b-d90c-b725-c084c8304f02@gmail.com> (raw)
In-Reply-To: <pull.1174.git.git.1640650846612.gitgitgadget@gmail.com>
On 12/27/2021 7:20 PM, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
>
> Ever since commit a492d5331c ("merge-ort: ensure we consult df_conflict
> and path_conflicts", 2021-06-30), when renormalization is active AND a
> file is involved in a rename/delete conflict BUT the file is unmodified
> (either before or after renormalization), merge-ort was running into an
> assertion failure.
This "the file is unmodified" is critical, as when I looked at the test,
it seemed too simple. I asked myself, "Why does renormalization matter
here?" Turns out it is just an artifact of the carefully organized cases.
> if (opt->renormalize &&
> blob_unchanged(opt, &ci->stages[0], &ci->stages[side],
> path)) {
> - ci->merged.is_null = 1;
> - ci->merged.clean = 1;
> - assert(!ci->df_conflict && !ci->path_conflict);
> + if (!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 */
> + }
This breakdown of the cases is informative, and I like how self-contained
the change is.
> +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
I tested this on the latest 'master' and saw the following:
git: merge-ort.c:3846: process_entry: Assertion `!ci->df_conflict && !ci->path_conflict' failed
so it indeed hits this case.
This patch looks good to me. Thanks!
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
next prev parent reply other threads:[~2021-12-28 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-28 0:20 [PATCH] merge-ort: fix bug with renormalization and rename/delete conflicts Elijah Newren via GitGitGadget
2021-12-28 13:55 ` Derrick Stolee [this message]
2021-12-30 22:56 ` Junio C Hamano
2021-12-30 23:35 ` Elijah Newren
2021-12-30 22:08 ` [PATCH v2] " Elijah Newren via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=78ba0d99-246b-d90c-b725-c084c8304f02@gmail.com \
--to=stolee@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).