From: Jeff King <peff@peff.net>
To: Philip Oakley <philipoakley@iee.email>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Git List" <git@vger.kernel.org>
Subject: Re: Trimming 'deadheads' (TREESAME 2nd parent) from revision walks?
Date: Mon, 20 Sep 2021 16:50:47 -0400 [thread overview]
Message-ID: <YUj0J+jY0jURkipM@coredump.intra.peff.net> (raw)
In-Reply-To: <88dfc31a-187c-6609-0df6-d6b970b1a136@iee.email>
On Mon, Sep 20, 2021 at 12:40:21PM +0100, Philip Oakley wrote:
> One thing that catches me, and I think others, is how the 'strategies'
> work. IIUC a merge will look at each line in the diff, and accept any
> change on either side that has no conflicts within the context zone.
> It's only when there are changes from both sides that the selection
> strategy kicks in. But it is difficult to describe, so it's easy to be
> confused.
I think you might be confusing the "ours" strategy (which takes the
tree state of the first parent entirely) with the "ours" (and "theirs")
options of the merge-recursive (or ort) strategy.
You can see the difference with:
git init repo
cd repo
echo base >file
git add file
git commit -m base
echo main >file
git add file
git commit -m main
git checkout -b side HEAD^
echo side >file
echo unrelated >another
git add file another
git commit -m side
git checkout -b strategy-ours main
git merge -s ours side
git checkout -b option-ours main
git merge -X ours side
The strategy-ours merge will drop "another", because it was not in the
first parent. Whereas option-ours will keep it, preferring the
first parent only for the conflict in "file".
You could construct a similar example where instead of a second file,
there's enough content in "file" that some of it does not conflict.
-Peff
next prev parent reply other threads:[~2021-09-20 20:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 14:18 Trimming 'deadheads' (TREESAME 2nd parent) from revision walks? Philip Oakley
2021-09-19 18:59 ` Jeff King
2021-09-19 23:44 ` Ævar Arnfjörð Bjarmason
2021-09-20 11:40 ` Philip Oakley
2021-09-20 20:50 ` Jeff King [this message]
2021-09-21 13:36 ` Philip Oakley
2021-09-21 18:24 ` Philip Oakley
2021-10-05 10:53 ` Johannes Schindelin
2021-10-06 14:03 ` Philip Oakley
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=YUj0J+jY0jURkipM@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.email \
/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).