tag: use strbuf to format tag header
commitb0ceab98d72a4861a8cea061487169fb5468b736
authorJeff King <peff@peff.net>
Tue, 28 Mar 2017 19:46:23 +0000 (28 15:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Mar 2017 21:59:50 +0000 (30 14:59 -0700)
tree1994fcfed5274f1aab90cbca342d288584dcd608
parent977db6b4bf36e76dfd5d0a4ae8b8258334d4b1ea
tag: use strbuf to format tag header

We format the tag header into a fixed 1024-byte buffer. But
since the tag-name and tagger ident can be arbitrarily
large, we may unceremoniously die with "tag header too big".
Let's just use a strbuf instead.

Note that it looks at first glance like we can just format
this directly into the "buf" strbuf where it will ultimately
go. But that buffer may already contain the tag message, and
we have no easy way to prepend formatted data to a strbuf
(we can only splice in an already-generated buffer). This
isn't a performance-critical path, so going through an extra
buffer isn't a big deal.

Signed-off-by: Jeff King <peff@peff.net>
builtin/tag.c