Re: "git shortlog -sn --follow -- <path>" counts all commits to entire repo
- From
Jeff King <peff@peff.net>
- Date
- Sep 8, 2017, 07:49 UTC
- Message-ID
- <20170908074910.reoyb47navgsg6kt@sigill.intra.peff.net>
- In-Reply-To
- <xmqqo9qlzodi.fsf@gitster.mtv.corp.google.com>
On Fri, Sep 08, 2017 at 03:38:17PM +0900, Junio C Hamano wrote:
Show 8 quoted lines
> > I suspect a better solution might involve actually building on > > log-tree.c to do the traversal (since this internal traversal is > > supposed to be equivalent to "git log | git shortlog"). > > Probably. That approach would also have an added benefit that when > "--follow" is fixed to keep track of which path it is following per > traversal for "git log", the result from "git shortlog --follow" > would automatically become correct, I guess?
Yeah. It depends on exactly how such a fix is made. I think one improvement would be to actually bump --follow handling into the limit_list() stage, so that we properly handle history simplification over followed paths. In which case get_revision() would just never return the uninteresting commits, and the current shortlog code would Just Work.
That said, I don't think we can go wrong by making shortlog's traversal more like log's. Any changes we make to --follow will be aimed at and tested with git-log, so the more code they share the more likely it is that shortlog won't bitrot.
-Peff