git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Stephen Connolly <stephen.alan.connolly@gmail.com>, git@vger.kernel.org
Subject: Re: [Feature Request] git blame showing only revisions from git rev-list --first-parent
Date: Sun, 13 Sep 2015 06:07:29 -0400	[thread overview]
Message-ID: <20150913100728.GA26562@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqy4gcxcp4.fsf@gitster.mtv.corp.google.com>

On Sat, Sep 12, 2015 at 01:29:43AM -0700, Junio C Hamano wrote:

> >> -		for (p = commit->parents; p; p = p->next)
> >> +		for (p = commit->parents;
> >> +		     p && !revs->first_parent_only;
> >> +		     p = p->next)
> >>  			add_child(revs, p->item, commit);
> >>  	}
> >>  }
> 
> ... this is a total crap and shows that I am doubly an idiot.
> 
> The loop is a no-op when first-parent-only (the intent is to call
> add-child for just the first parent), so the code is stupid and
> wrong in the first place, but more importantly, the logic is utterly
> confused.

Whoops, yeah. I think you need "if (revs->first_parent_only) break;".

> The thing is, traversing first-parent chain in reverse fundamentally
> is undefined.  You can fork multiple topics at the tip of 'master'
> and each of the topics may be single strand of pearls, but which one
> of the topics is the first-child-chain---there is no answer to that
> question.

In general I think I agree, but in the case of blame, we know that we
are starting from a single tip (and we know because we are using
first-parent that we remain in a single strand of pearls, because we
follow only one parent and there are no cycles).

That is assuming that we create the set of children by traversing the
first-parent history, though, which I am not at all sure about.

-Peff

  parent reply	other threads:[~2015-09-13 10:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 10:47 [Feature Request] git blame showing only revisions from git rev-list --first-parent Stephen Connolly
2015-09-11 14:01 ` Jeff King
2015-09-11 15:31   ` Stephen Connolly
2015-09-11 16:35   ` Junio C Hamano
2015-09-11 19:06     ` Junio C Hamano
2015-09-12  3:30       ` Jeff King
2015-09-12  8:29         ` Junio C Hamano
2015-09-12 22:09           ` Philip Oakley
2015-09-13 10:07           ` Jeff King [this message]
2015-09-14  5:19             ` Junio C Hamano
2015-09-15 10:05               ` Jeff King
2015-09-16  1:14                 ` Junio C Hamano
2015-09-16 17:37                   ` Jeff King
2015-09-17 17:03                     ` Junio C Hamano
2015-10-18 11:38                 ` Max Kirillov
2015-10-18 17:41                   ` 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=20150913100728.GA26562@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=stephen.alan.connolly@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.
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).