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: Wed, 30 May 2018 11:20:40 +0300 [thread overview]
Message-ID: <97644280-2187-d314-37ce-2c79935a63bc@bracey.fi> (raw)
In-Reply-To: <20180529210434.GA3857@sigill.intra.peff.net>
On 30/05/2018 00:04, Jeff King wrote:
>
> Do we even need to do the parent rewriting here? By definition those
> parents aren't interesting, and we're TREESAME to whatever is in
> treesame_parents. So conceptually it seems like we just need a flag "I
> found a treesame parent", but we only convert that into a TREESAME flag
> if there are no relevant parents.
I think it's necessary to make the rules consistent. To mark the commit
as TREESAME here when it's not TREESAME to all its parents would be
inconsistent with the definition of the TREESAME flag used everywhere else:
* Original definition: "A commit is TREESAME if it is treesame to any
parent"
* d0af66 definition: "A commit is TREESAME if it is treesame to all parents"
* Current 4d8266 definition: "A commit is TREESAME if it is treesame to
all relevant parents; if no relevant parents then if it is treesame to
all (irrelevant) parents."
The current problem is that the node is not marked TREESAME, but that's
consistent with the definition. I think we do have to rewrite the commit
so it is TREESAME as per the definition. Not flag it as TREESAME in
violation of it.
It's possible you *could* get away with just flagging, because we never
recompute the TREESAME flag in simple history mode. But it would be a
cheat, and it may have other side effects. It means this node would
remain a special rare case for others to trip up on later. And I don't
think it simplifies the scan. Remembering
"pointer-to-first-treesame-parent" (not a list) for the rewrite is no
more complex than remembering "bool-there-was-a-treesame-parent". (A
bool is what earlier code did - it worked for the original TREESAME
definition. My patch series dropped that bool without replacement -
missing this all-irrelevant case).
In the simple history mode, the assumption is we're "simplifying away
merges up-front" here; we won't (and can't) rewrite parents later in a
way that needs to recompute TREESAME. In the initial scan when all
parents are relevant and we matched one, the commit became TREESAME as
per the new definition immediately because of the rewrite. This applies
the equivalent rewrite when no relevant parents, consistent with the
general concept, and without changing the TREESAME definition.
Kevin
next prev parent reply other threads:[~2018-05-30 8:40 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
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 [this message]
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=97644280-2187-d314-37ce-2c79935a63bc@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).