diff options
author | Jeff King <peff@peff.net> | 2017-09-08 05:21:27 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-09 01:57:03 +0900 |
commit | 1ab03a57e1856b3619accb1d42e997bc84cae79f (patch) | |
tree | 831410ba279342e91c5c7a58b0a8d2681c9b3ea6 /diff.h | |
parent | edc74bc7f0c6884027e851ef09b2e0c9380dcd45 (diff) | |
download | git-jk/shortlog-ident-cleanup.tar.gz |
shortlog: skip format/parse roundtrip for internal traversaljk/shortlog-ident-cleanup
The original git-shortlog command parsed the output of
git-log, and the logic went something like this:
1. Read stdin looking for "author" lines.
2. Parse the identity into its name/email bits.
3. Apply mailmap to the name/email.
4. Reformat the identity into a single buffer that is our
"key" for grouping entries (either a name by default,
or "name <email>" if --email was given).
The first part happens in read_from_stdin(), and the other
three steps are part of insert_one_record().
When we do an internal traversal, we just swap out the stdin
read in step 1 for reading the commit objects ourselves.
Prior to 2db6b83d18 (shortlog: replace hand-parsing of
author with pretty-printer, 2016-01-18), that made sense; we
still had to parse the ident in the commit message.
But after that commit, we use pretty.c's "%an <%ae>" to get
the author ident (for simplicity). Which means that the
pretty printer is doing a parse/format under the hood, and
then we parse the result, apply the mailmap, and format the
result again.
Instead, we can just ask pretty.c to do all of those steps
for us (including the mailmap via "%aN <%aE>", and not
formatting the address when --email is missing).
And then we can push steps 2-4 into read_from_stdin(). This
speeds up "git shortlog -ns" on linux.git by about 3%, and
eliminates a leak in insert_one_record() of the namemailbuf
strbuf.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.h')
0 files changed, 0 insertions, 0 deletions