git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Feature Request] git blame showing only revisions from git rev-list --first-parent

From
Jeff King <peff@peff.net>
Date
Sep 13, 2015, 10:07 UTC
Message-ID
<20150913100728.GA26562@sigill.intra.peff.net>
In-Reply-To
<xmqqy4gcxcp4.fsf@gitster.mtv.corp.google.com>
On Sat, Sep 12, 2015 at 01:29:43AM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> >> -		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;".
Show 5 quoted lines
> 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
Previous: Philip OakleyNext: Junio C Hamano
Message 9 of 16 in “[Feature Request] git blame showing only revisions from git rev-list --first-parent”
  1. Stephen ConnollySep 11, 2015
  2. Jeff KingSep 11, 2015
  3. Stephen ConnollySep 11, 2015
  4. Junio C HamanoSep 11, 2015
  5. Junio C HamanoSep 11, 2015
  6. Jeff KingSep 12, 2015
  7. Junio C HamanoSep 12, 2015
  8. Philip OakleySep 12, 2015
  9. Jeff KingSep 13, 2015
  10. Junio C HamanoSep 14, 2015
  11. Jeff KingSep 15, 2015
  12. Junio C HamanoSep 16, 2015
  13. Jeff KingSep 16, 2015
  14. Junio C HamanoSep 17, 2015
  15. Max KirillovOct 18, 2015
  16. Junio C HamanoOct 18, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.