archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <>
To: Johannes Schindelin <>
Cc: Johannes Schindelin via GitGitGadget <>,
	Git Mailing List <>
Subject: Re: [PATCH 1/3] merge-tree -z: always show the original file name first
Date: Sat, 20 Aug 2022 16:22:30 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <44pr310n-rpr1-0660-0961-386rsq9q11o1@tzk.qr>

On Fri, Aug 19, 2022 at 2:17 AM Johannes Schindelin
<> wrote:
> Hi all (and I guess in particular Elijah),
> On Fri, 19 Aug 2022, Johannes Schindelin via GitGitGadget wrote:
> > diff --git a/t/ b/t/
> > index 35f94957fce..bc580a242ac 100755
> > --- a/t/
> > +++ b/t/
> > @@ -131,11 +131,12 @@ test_expect_success 'setup non-content conflicts' '
> >  test_expect_success 'remerge-diff with non-content conflicts' '
> >       git log -1 --oneline resolution >tmp &&
> >       cat <<-EOF >>tmp &&
> > +     diff --git a/file_or_directory b/file_or_directory
> > +     remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead.
> >       diff --git a/file_or_directory~HASH (side1) b/wanted_content
> >       similarity index 100%
> >       rename from file_or_directory~HASH (side1)
> >       rename to wanted_content
> > -     remerge CONFLICT (file/directory): directory in the way of file_or_directory from HASH (side1); moving it to file_or_directory~HASH (side1) instead.
> >       diff --git a/letters b/letters
> >       remerge CONFLICT (rename/rename): letters renamed to letters_side1 in HASH (side1) and to letters_side2 in HASH (side2).
> >       diff --git a/letters_side2 b/letters_side2
> I would have liked to avoid touching this file altogether, of course, but
> when I investigated, I came to the conclusion that while this patch still
> does not produce the best possible outcome for remerge diffs, it does
> improve upon the current situation.

No, this is a strict regression.  Those file headers corresponding to
the file/directory conflict (similarity index, rename from/to, and
CONFLICT) are all supposed to be grouped together in the same diff
header.  As to the names...

> The thing is, when mentioning that we had to rename `file_or_directory` to
> `file_or_directory~HASH (side1)` to be able to write the file because a
> directory of the same name already was in the way, I would actually have
> expected this to come under the diff header
>         diff --git a/file_or_directory b/file_or_directory~HASH (side1)
> Previously, it was under the header
>         diff --git a/file_or_directory~HASH (side1) b/wanted_content
> and with this patch it is under
>         diff --git a/file_or_directory b/file_or_directory
> which is still not ideal: It mentions only the original file name, not the
> munged one.

The point of remerge-diff is to show how a user modifies from the
auto-merged state to the final merge commit.  As such, the filenames
from before the merge starts are irrelevant; the only two relevant
things are the filename at the end of the automatic merge, and the
filename recorded in the commit.

In particular, for the case here, upon "git merge $BRANCH" the merge
would have stopped with a file named "file_or_directory~HASH\ (side1)"
present in the working copy[1].  The user resolved it via renaming
that file to "wanted_content".  As such, the first and third options
you list are incorrect, and the second one -- from the behavior
previous to your patch -- is correct.

[1] Technically, "git merge $BRANCH" would have used "HEAD" rather
than "HASH (side1)", but that's only because at the time of invocation
of git merge, HEAD would have been a very specific commit.  The same
isn't true of HEAD when the user runs `git log --remerge-diff` at some
very different time, so we opt to replace "HEAD" with something more
meaningful for readers of the diff when running --remerge-diff.

  reply	other threads:[~2022-08-20 23:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19  6:57 [PATCH 0/3] Show original filenames in merge tree Johannes Schindelin via GitGitGadget
2022-08-19  6:57 ` [PATCH 1/3] merge-tree -z: always show the original file name first Johannes Schindelin via GitGitGadget
2022-08-19  9:17   ` Johannes Schindelin
2022-08-20 23:22     ` Elijah Newren [this message]
2022-08-20 23:17   ` Elijah Newren
2022-08-21  2:00     ` Elijah Newren
2022-08-22 20:12     ` Johannes Schindelin
2022-08-23  6:24       ` Elijah Newren
2022-08-26 15:35         ` Johannes Schindelin
2022-08-30  2:13           ` Elijah Newren
2022-08-19  6:57 ` [PATCH 2/3] merge-tree: show the original file names in the conflict output Johannes Schindelin via GitGitGadget
2022-08-19  6:57 ` [PATCH 3/3] t4301: add a test case involving a rename, type change & modification Johannes Schindelin 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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.
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 NNTP newsgroup(s).