From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [sort-of-BUG] merge-resolve cannot resolve "content/mode" conflict
Date: Wed, 18 May 2016 21:03:18 -0400 [thread overview]
Message-ID: <20160519010318.GA23155@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqh9fh5lcl.fsf@gitster.mtv.corp.google.com>
On Mon, Apr 04, 2016 at 10:34:34AM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > Imagine a merge where one side changes the content of a path and the
> > other changes the mode. Here's a minimal reproduction:
> >
> > git init repo && cd repo &&
> >
> > echo base >file &&
> > git add file &&
> > git commit -m base &&
> >
> > echo changed >file &&
> > git commit -am content &&
> >
> > git checkout -b side HEAD^
> > chmod +x file &&
> > git commit -am mode
> > ...
> > This is a leftover from my experiments with merge-resolve versus
> > merge-recursive last fall, which resulted in a few actual bug-fixes. I
> > looked into fixing this case, too, at that time. It seemed possible, but
> > a little more involved than you might think (because the logic is driven
> > by a bunch of case statements, and this adds a multiplicative layer to
> > the cases; we might need to resolve the permissions, and _then_ see if
> > the content can be resolved).
>
> Perhaps I am missing some other codepath in the "multiplicative"
> layer, but is this not sufficient?
Sorry for the super-slow reply; just cleaning out my "to respond to"
pile, which has gotten pretty deep.
Looking at it again, I think you are right. I seemed to recall that
there were multiple case arms where we dealt with the permissions, but I
cannot find such a spot now. So I think the solution you outlined looks
good.
> - if test "$6" != "$7"
> + # Three-way merge of the permissions
> + perm= ;# assume the result is the same from stage #2, i.e. $6
> + if test "$6" = "$7" || test "$5" = "$7"
> + then
> + : nothing
> + elif test "$5" = "$6"
> then
> + case "$7" in
> + 100644) perm=-x ;;
> + 100755) perm=+x ;;
> + *) echo "ERROR: $7: funny filemode not handled." >&2 ;;
> + esac
We reject symlinks and submodules earlier, so I think this "funny
filemode" error really should only be truly-funny entries. Good.
-Peff
prev parent reply other threads:[~2016-05-19 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-03 5:26 [sort-of-BUG] merge-resolve cannot resolve "content/mode" conflict Jeff King
2016-04-04 17:34 ` Junio C Hamano
2016-05-19 1:03 ` Jeff King [this message]
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=20160519010318.GA23155@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).