shortlog: replace hand-parsing of author with pretty-printer
authorJeff King <peff@peff.net>
Mon, 18 Jan 2016 20:02:48 +0000 (15:02 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Jan 2016 17:54:14 +0000 (09:54 -0800)
When gathering the author and oneline subject for each
commit, we hand-parse the commit headers to find the
"author" line, and then continue past to the blank line at
the end of the header.

We can replace this tricky hand-parsing by simply asking the
pretty-printer for the relevant items. This also decouples
the author and oneline parsing, opening up some new
optimizations in further commits.

One reason to avoid the pretty-printer is that it might be
less efficient than hand-parsing. However, I measured no
slowdown at all running "git shortlog -ns HEAD" on
linux.git.

As a bonus, we also fix a memory leak in the (uncommon) case
that the author field is blank.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found