Subject: [PATCH 5/5] git-tag: call verify_tag_buffer to validate the generated tag object

From: [email-masked]
Date: Thu, 8 May 2008 21:19:49 -0500

From: Brandon Casey <[email-masked]>

This will ensure that both git-tag and git-mktag "produce valid tags,
with the same definition of validity."

Signed-off-by: Brandon Casey <[email-masked]>
---
 builtin-tag.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-tag.c b/builtin-tag.c
index 85ec2f3..0f79d47 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -508,6 +508,8 @@ static void create_tag(const unsigned char *object, const char *tag,
 
 	if (sign && do_sign(buf) < 0)
 		die("unable to sign the tag");
+	if (verify_tag_buffer(buf->buf, buf->len) < 0)
+		die("invalid tag object");
 	if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0)
 		die("unable to write tag file");
 }
-- 
1.5.5.67.g9a49