summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca51699)
raw | patch | inline | side by side (parent: ca51699)
author | Jeff King <peff@peff.net> | |
Mon, 6 Feb 2012 08:13:42 +0000 (03:13 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Feb 2012 18:00:51 +0000 (10:00 -0800) |
We don't usually bother looking at tagged objects at all
when listing. However, if "-n" is specified, we open the
objects to read the annotations of the tags. If we fail to
read an object, or if the object has zero length, we simply
silently return.
The first case is an indication of a broken or corrupt repo,
and we should notify the user of the error.
The second case is OK to silently ignore; however, the
existing code leaked the buffer returned by read_sha1_file.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when listing. However, if "-n" is specified, we open the
objects to read the annotations of the tags. If we fail to
read an object, or if the object has zero length, we simply
silently return.
The first case is an indication of a broken or corrupt repo,
and we should notify the user of the error.
The second case is OK to silently ignore; however, the
existing code leaked the buffer returned by read_sha1_file.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/tag.c | patch | blob | history |
diff --git a/builtin/tag.c b/builtin/tag.c
index 391160cf83338e1f18de5564cf1c0b2f78debefd..1e27f5c3d6ee9a5f6d4209cf048be5a66ca12125 100644 (file)
--- a/builtin/tag.c
+++ b/builtin/tag.c
size_t len;
buf = read_sha1_file(sha1, &type, &size);
- if (!buf || !size)
+ if (!buf)
+ die_errno("unable to read object %s", sha1_to_hex(sha1));
+ if (!size) {
+ free(buf);
return;
+ }
/* skip header */
sp = strstr(buf, "\n\n");