From: Kevin Bracey <kevin@bracey.fi>
To: "Jeff King" <peff@peff.net>, "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Git mailing list <git@vger.kernel.org>
Subject: Re: Weird revision walk behaviour
Date: Sun, 27 May 2018 20:37:00 +0300 [thread overview]
Message-ID: <cb1d7c86-a989-300a-01d2-923e9c29e834@bracey.fi> (raw)
In-Reply-To: <869a4045-0527-3dcf-33b3-90de2a45cd51@bracey.fi>
On 24/05/2018 23:26, Kevin Bracey wrote:
>
>>> On Wed, May 23, 2018 at 07:10:58PM +0200, SZEDER Gábor wrote:
>>>
>>>> $ git log --oneline master..ba95710a3b -- ci/
>>>> ea44c0a594 Merge branch 'bw/protocol-v2' into
>>>> jt/partial-clone-proto-v2
>>>>
> In this case, we're hitting a merge commit which is not on master, but
> it has two parents which both are. Which, IIRC, means the merge commit
> is INTERESTING with two UNINTERESTING parents; and we are TREESAME to
> only one of them.
>
> The commit changing the logic of TREESAME you identified believes that
> those TREESAME changes for merges which were intended to improve
> fuller history modes shouldn't affect the simple history "because
> partially TREESAME merges are turned into normal commits". Clearly
> that didn't happen here.
>
Haven't currently got a development environment set up here, but I've
been looking at the code.Here's a proposal, untested, as a potential
starting point if anyone wants to consider a proper patch.
The simplify_history first-scan logic never actually turned merges into
simple commits unless they were TREESAME to a relevant/interesting
parent. Anything where the TREESAME parent was UNINTERESTING was
retained as a merge, but had its TREESAME flag set, and that permitted
later simplification.
With the redefinition of the TREESAME flag, this merge commit is no
longer TREESAME, and as the decoration logic to refine TREESAME isn't
active for simplify_history, it doesn't get cleaned up (even if it would
be in full history?)
I think the answer may be to add an extra post-process step on the
initial loop to handle this special case. Something like:
case REV_TREE_SAME:
if (!revs->simplify_history || !relevant_commit(p)) {
/* Even if a merge with an uninteresting
* side branch brought the entire change
* we are interested in, we do not want
* to lose the other branches of this
* merge, so we just keep going.
*/
if (ts)
ts->treesame[nth_parent] = 1;
+ /* But we note it for potential later simplification */
+ if (!treesame_parent)
+ treesame_parent = p;
continue;
}
...
After loop:
+ if (relevant_parents == 0 && revs->simplify_history &&
treesame_parent) {
+ treesame_parent->next = NULL;// Repeats code from loop -
share somehow?
+ commit->parents = treesame_parent;
+ commit->object.flags |= TREESAME;
+ return;
+ }
/*
* TREESAME is straightforward for single-parent commits. For merge
The other option would be to take off the " || !relevant_commit(p)"
test, but I'm assuming that is still needed for other cases.
Kevin
next prev parent reply other threads:[~2018-05-27 17:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 17:10 Weird revision walk behaviour SZEDER Gábor
2018-05-23 17:32 ` Jeff King
2018-05-23 17:35 ` Jeff King
2018-05-24 18:54 ` Kevin Bracey
2018-05-24 20:26 ` Kevin Bracey
2018-05-27 17:37 ` Kevin Bracey [this message]
2018-05-28 22:06 ` SZEDER Gábor
2018-05-29 6:11 ` Kevin Bracey
2018-05-29 21:04 ` Jeff King
2018-05-30 8:20 ` Kevin Bracey
2018-05-31 5:43 ` Jeff King
2018-05-31 14:54 ` Kevin Bracey
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=cb1d7c86-a989-300a-01d2-923e9c29e834@bracey.fi \
--to=kevin@bracey.fi \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=szeder.dev@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.
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).