am: simplify allocations in get_commit_info()
commit2e2bbb9624e10537560c3ac45ff6820ff773b3d6
authorJeff King <peff@peff.net>
Thu, 27 Apr 2017 03:27:17 +0000 (26 23:27 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Apr 2017 05:38:55 +0000 (27 14:38 +0900)
tree71bd4bdda3292666974f4c7d456003e3e7b5e735
parentf131db9e3166c528d3b0352b653eb0d9deca5a65
am: simplify allocations in get_commit_info()

After we call split_ident_line(), we have several begin/end
pairs for various parts of the ident. We then copy each into
a strbuf to create a single string, and then detach that
string.  We can instead skip the strbuf entirely and just
duplicate the strings directly.

This is shorter, and it makes it more obvious that we are
not leaking the strbuf (we were not before, because every
code path either died or hit a strbuf_detach).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c