git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Stephen R. van den Berg" <srb@cuci.nl>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Simplify and fix --first-parent implementation
Date: Fri, 25 Apr 2008 17:11:53 -0700	[thread overview]
Message-ID: <7viqy5o4om.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080425234556.D60FD5461@aristoteles.cuci.nl> (Stephen R. van den Berg's message of "Fri, 25 Apr 2008 20:10:46 +0200")

"Stephen R. van den Berg" <srb@cuci.nl> writes:

> ---

No explanation of what the patch does, nor justification of why it is a
good change?

Please also sign your patch.

> @@ -462,19 +461,18 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit, str
>  
>  	left_flag = (commit->object.flags & SYMMETRIC_LEFT);
>  
> -	rest = !revs->first_parent_only;
> -	for (parent = commit->parents, add = 1; parent; add = rest) {
> +	for (parent = commit->parents; parent; parent = parent->next) {
>  		struct commit *p = parent->item;
>  
> -		parent = parent->next;
>  		if (parse_commit(p) < 0)
>  			return -1;
>  		p->object.flags |= left_flag;
>  		if (p->object.flags & SEEN)
>  			continue;
>  		p->object.flags |= SEEN;
> -		if (add)
> -			insert_by_date(p, list);
> +		insert_by_date(p, list);
> +		if(revs->first_parent_only)
> +			break;
>  	}

The original code makes sure all the parents of the given commits are
marked as SEEN (and SYMMETRIC_LEFT if needed), even when only it traverses
the first parent.  By leaving the loop early, you are changing the
semantics of the code.  Other parents, when reached from other paths while
traversing the commit ancestry chain, will behave differently between the
version with your patch and without.

You would need to explain how and why that behaviour change is a "fix" in
the proposed commit log message.  "Before the change, traversing a history
of this shape behaves like this, but that is wrong for such and such
reasons, and I identified the culprit to be this code.  With this patch,
the same traversal will instead behave this way, which is what I expect to
be the right behaviour".

  reply	other threads:[~2008-04-26  0:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25 18:10 [PATCH] Simplify and fix --first-parent implementation Stephen R. van den Berg
2008-04-26  0:11 ` Junio C Hamano [this message]
2008-04-26 11:59   ` Stephen R. van den Berg
2008-04-26 12:27     ` Jeff King
2008-04-26 19:13     ` Junio C Hamano

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=7viqy5o4om.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=srb@cuci.nl \
    /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).