From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Daniel Hagerty <hag@linnaean.org>, git@vger.kernel.org
Subject: Re: git merge a b when a == b but neither == o is always a successful merge?
Date: Fri, 21 Nov 2014 10:51:28 -0800 [thread overview]
Message-ID: <xmqqwq6oz8sv.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20141121181539.GC26650@peff.net> (Jeff King's message of "Fri, 21 Nov 2014 13:15:40 -0500")
Jeff King <peff@peff.net> writes:
> This is the first use of gitattributes in the unpack-trees code path. I
> cannot think offhand of any philosophical reason that should not be OK,
> but it is something worth considering (i.e., this code path is deep
> plumbing; are there cases where we would not want to support
> gitattributes?).
It is not about "not want to support", but mroe about "not want to
be affected (by user preference)", and it is a valid concern.
> ... if I have a tree that starts at
> sha1 X, and ends up at sha1 Y in both sides of the merge, do we still
> descend into it to make the file-level comparisons, or do we optimize
> that out?
The code to look at is unpack-trees.c::unpack_callback(); even
though it does try to be clever to do that exact optimization when
it is used for "diff-index --cached", I do not think we do it during
a real merge.
>> + struct git_attr_check check;
>> + check.attr = git_attr("merge-minimal");
>> + (void) git_check_attr(path, 1, &check);
>
> Please void C99 decl-after-statement, as we build on older compilers
> that do not like it.
Also I do not think we want to keep calling git_attr() interning
function. All existing uses (well, at least the ones that were
written by those who know what they are doing ;-) should be avoiding
repeated look-ups, and if we are to use an attribute for this, we
should do the same.
Do we name our attributes with "dashes-in-its-name"? I am not
asking if dashes are allowed (I know it is), but if that breaks
the pattern already established for the core part of the system
and makes this new one an oddball.
> We also do not typically annotate ignored return values.
True.
>
>> + if(ATTR_TRUE(check.value))
>> + xmp.level = XDL_MERGE_MINIMAL;
>> + else
>> + xmp.level = XDL_MERGE_ZEALOUS;
>
> ..and indentations should be a single tab.
True, too.
> Other than those minor style nits, I do not see anything obviously
> _wrong_ with the patch, but I am far from an expert in the area.
I agree that the approach taken here is a sensible way to implement
the design, _if_ the design and the problem it tries to solve makes
sense. I am not sure about that yet myself, though.
next prev parent reply other threads:[~2014-11-21 18:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 18:39 git merge a b when a == b but neither == o is always a successful merge? Daniel Hagerty
2014-11-17 20:53 ` Jeff King
2014-11-17 22:21 ` Daniel Hagerty
2014-11-21 18:15 ` Jeff King
2014-11-21 18:51 ` Junio C Hamano [this message]
2014-11-24 19:36 ` Daniel Hagerty
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=xmqqwq6oz8sv.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hag@linnaean.org \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.