git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Torek <chris.torek@gmail.com>
To: Elijah Newren <newren@gmail.com>
Cc: Sergey Organov <sorganov@gmail.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Tiran Meltser <Tiran.Meltser@mavenir.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	Amir Yosef <Amir.Yosef@mavenir.com>
Subject: Re: Request for adding a simple mechanism to exclude files from Git merge operation
Date: Tue, 23 Jun 2020 15:57:38 -0700	[thread overview]
Message-ID: <CAPx1Gvc6X5zgHXfnaKD+sBM=P1ve4raR5tJzTaZnwwTugBva_A@mail.gmail.com> (raw)
In-Reply-To: <CABPp-BFwNnD-zZvHjCAvvmzy1wTT3yy-smK5nCtQ937apaNmkQ@mail.gmail.com>

I'm going to snip a lot here as I'm not really replying to one
specific proposal or another.  I just want to add some background:

On Tue, Jun 23, 2020 at 2:48 PM Elijah Newren <newren@gmail.com> wrote:
> Once you record the information for which files it applies to, then
> you want it to happen whenever the merge machinery fires, right?

This is, of course, already the case for merge drivers defined and
used in .gitattributes entries (though note that they don't apply to some
merge *strategies*, e.g., `-s ours` completely ignores them).

> The problems I was raising were not with the resulting end-state tree
> that users can construct or what happens with those trees once
> constructed.  My problems were with expected automatic behavior from
> the merge machinery coupled with incomplete specifications that
> sounded to me like a pile of corner cases and bugs that I'd have to
> field while trying to maintain the merge machinery logic.

This is already a bit of a problem with merge drivers in .gitattributes.
In particular, suppose we're doing a standard merge of commits H
(HEAD) and T (theirs) with respect to B (base).  If the file is named
"foo" and there is a merge driver defined for "foo", this merge driver
is completely ignored *unless* all three copies of foo differ!  And of
course there are rename issues if a file's name was foo but isn't now
or vice versa.

I do think it might be reasonable to be able to mark a merge driver
as "always use this, even if two or even all three inputs are the same".

> Oh, and I have a problem with "branch specific" files from the email
> you were responding to.  I think those are a code smell.  But my
> primary concern was the expectations of some new automatic behavior
> out of the merge machinery and how/if it gets configured.

They're not only smelly :-) ... they don't even really mean anything.
In particular, merge works not on *branches* but on *commits*.  If
we're merging commits H and T with base B, we may not be on any
branch at all (detached HEAD) and there could be anywhere from
zero to arbitrarily many branch names pointing at or containing each
of the three commits.  But of course it's common to have one branch
name for each of H and T, and that's where most people who want
this are coming from.

In any case, the merge driver stuff is useful to some people sometimes.
It might be a little more useful if you could force `git merge` to use it
even if only "their side" of the merge has changed the file since the
merge base.

Chris

  reply	other threads:[~2020-06-23 22:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 18:21 Request for adding a simple mechanism to exclude files from Git merge operation Tiran Meltser
2020-06-21 15:43 ` Philip Oakley
2020-06-22 18:42   ` [E] " Tiran Meltser
2020-06-22 19:41 ` brian m. carlson
2020-06-23 12:44   ` Sergey Organov
2020-06-23 16:16     ` Philip Oakley
2020-06-23 17:23       ` Sergey Organov
2020-06-23 17:08     ` Elijah Newren
2020-06-23 20:19       ` Sergey Organov
2020-06-23 21:46         ` Elijah Newren
2020-06-23 22:57           ` Chris Torek [this message]
2020-06-24 19:15           ` Sergey Organov
2020-06-23 22:38       ` Junio C Hamano
2020-06-24 18:03         ` Sergey Organov
2020-06-24 22:38           ` Junio C Hamano
2020-06-25 11:46             ` Sergey Organov

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

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

  git send-email \
    --in-reply-to='CAPx1Gvc6X5zgHXfnaKD+sBM=P1ve4raR5tJzTaZnwwTugBva_A@mail.gmail.com' \
    --to=chris.torek@gmail.com \
    --cc=Amir.Yosef@mavenir.com \
    --cc=Tiran.Meltser@mavenir.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=sorganov@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.
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).