git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Martin von Zweigbergk <martinvonz@gmail.com>
To: Michael McClimon <michael@mcclimon.org>
Cc: git <git@vger.kernel.org>
Subject: Re: Potential bug with octopus merges and symlinks
Date: Mon, 6 Dec 2021 08:53:12 -0800	[thread overview]
Message-ID: <CANiSa6jVp5EV73NxchFhHfZxxetdybhZ6r2qXE8O22e8rgpgVg@mail.gmail.com> (raw)
In-Reply-To: <20211202030458.GA48278@newk>

On Sat, Dec 4, 2021 at 5:20 AM Michael McClimon <michael@mcclimon.org> wrote:
>
> There is a minimal reproducer available at
> https://github.com/mmcclimon/git-merge-problem-demo. Fetch all the branches
> there. The main branch contains a directory (dir1) with a single file
> (file.txt), plus a symlink (dir2), which links to dir1. branch1 replaces this
> symlink with a copy of the files that were linked to. (This was accomplished
> with: rm dir2; cp -r dir1 dir2.) branch2 and branch3 do not touch this
> directory at all.
>
> Merging these three branches fails:
>
> $ git merge branch1 branch2 branch3
> Fast-forwarding to: branch1
> Trying simple merge with branch2
> Simple merge did not work, trying automatic merge.
> Trying simple merge with branch3
> error: Entry 'dir2/file.txt' not uptodate. Cannot merge.
> Merge with strategy octopus failed.
>
> The order here matters! Here is every permutation (1 here is the symlink
> change) to git merge; only the first two fail, all the others work.
>
> 1 2 3   FAIL
> 1 3 2   FAIL
> 2 1 3   PASS
> 2 3 1   PASS
> 3 1 2   PASS
> 3 2 1   PASS
> 1 2     PASS
> 2 1     PASS
> 2 3     PASS
> 3 2     PASS
> 1 3     PASS
> 3 1     PASS

I'm not a Git contributor (since ~10 years ago) but I was curious and
tried your repro myself. Thanks for the very simple instructions.
Maybe it's useful to see what the error is when you use the octopus
strategy to merge only two commits:

```
$ git checkout origin/branch1
$ git merge -s octopus origin/branch2
Trying really trivial in-index merge...
error: Merge requires file-level merging
Nope.
Merge with strategy octopus failed.
```

That "Merge requires file-level merging" is surprising but maybe the
"really trivial" is the explanation :) My *guess* is the answer is
that the octopus strategy is really old and should be rewritten using
the new "ort" strategy (or maybe be integrated into it). I'm afraid I
can't think of a workaround for you (other than trying different
permutations until it works).

  parent reply	other threads:[~2021-12-06 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  3:04 Potential bug with octopus merges and symlinks Michael McClimon
2021-12-04 17:34 ` Elijah Newren
2021-12-06 16:53 ` Martin von Zweigbergk [this message]
2021-12-06 18:13 ` Junio C Hamano

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=CANiSa6jVp5EV73NxchFhHfZxxetdybhZ6r2qXE8O22e8rgpgVg@mail.gmail.com \
    --to=martinvonz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=michael@mcclimon.org \
    /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).