From: "Stephen R. van den Berg" <srb@cuci.nl>
To: Lars Hjemli <hjemli@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
nanako3@bluebottle.com, git@vger.kernel.org
Subject: Re: [PATCH v2] revision.c: really honor --first-parent
Date: Tue, 13 May 2008 22:15:22 +0200 [thread overview]
Message-ID: <20080513201522.GA11485@cuci.nl> (raw)
In-Reply-To: <1210605156-22926-1-git-send-email-hjemli@gmail.com>
Lars Hjemli wrote:
>In add_parents_to_list, if any parent of a revision had already been
>SEEN, the current code would continue with the next parent, skipping
>the test for --first-parent. This patch inverts the test for SEEN so
>that the test for --first-parent is always performed.
Let's put it this way:
- If there would have been only one path to any particular point in the
tree, then the --first-parent flag makes no differences, because the
tree wouldn't contain any merges to begin with.
- If a tree contains *any* merges (i.e. a commit with multiple parents),
then there are always multiple paths to some common ancestor, and
therefore depending on which path you travel up first, you sometimes get
clashes with the SEEN flag (unpredictable by definition).
- It would seem logical and sufficient to avoid this unpredictability by
utilising the --first-parent flag to present and walk a tree of commits
AS IF there were no merges.
- My original patch did just that, it simplified the code to make sure
that all other parents beside the first parent are ignored when
walking the tree.
- Your code now doesn't simplify the (IMO) convoluted walk, and still
marks things as seen, even though in the first-parent case, these
commits are not really seen at all. It implies that your code
generates differing output, depending on the merges present.
- The question now is, do we want the output of --first-parent to be
immutable with respect to merges being present (but hidden from sight
during a --first-parent run), or do we want the output of
--first-parent to actually change depending on variations in parents
other than the first parent?
I'd say it's better to keep the code simpler, and to make sure the
output does *not* depend on any parents other than the first (as
implemented in my original patch).
>This is a slightly different approach which I think is less ugly.
Your patch is smaller, and therefore (perhaps) less ugly; the resulting
code and logic of my original patch is simpler (IMHO), and therefore
cleaner (but it all depends on (the lack of) consensus over the points above).
--
Sincerely, srb@cuci.nl
Stephen R. van den Berg.
"If I had to live my life again, I'd make the same mistakes, only sooner."
next prev parent reply other threads:[~2008-05-13 20:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-11 7:03 "git log --first-parent" shows parents that are not first しらいしななこ
2008-05-11 18:44 ` Junio C Hamano
2008-05-11 23:14 ` [PATCH] revision.c: really honor --first-parent Lars Hjemli
2008-05-12 15:12 ` [PATCH v2] " Lars Hjemli
2008-05-13 20:15 ` Stephen R. van den Berg [this message]
2008-05-13 20:43 ` Lars Hjemli
2008-05-13 22:38 ` Junio C Hamano
2008-05-14 10:34 ` Stephen R. van den Berg
2008-05-14 10:54 ` Lars Hjemli
2008-05-14 11:10 ` Stephen R. van den Berg
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=20080513201522.GA11485@cuci.nl \
--to=srb@cuci.nl \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hjemli@gmail.com \
--cc=nanako3@bluebottle.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).