X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-tag.c;h=4aca3dc79b2a3d28f158ff61c01363244bfd7637;hb=2729cadca22dce2b5bb994581c45a6a71daf7998;hp=66e5a5830792471a44c9211d4eafcf2b1ff6f0dd;hpb=9c51414f8efb73525a6c69917f1499dab081679d;p=git.git diff --git a/builtin-tag.c b/builtin-tag.c index 66e5a5830..4aca3dc79 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -81,17 +81,16 @@ static int show_reference(const char *refname, const unsigned char *sha1, } printf("%-15s ", refname); - sp = buf = read_sha1_file(sha1, &type, &size); - if (!buf) + buf = read_sha1_file(sha1, &type, &size); + if (!buf || !size) return 0; - if (!size) { + + /* skip header */ + sp = strstr(buf, "\n\n"); + if (!sp) { free(buf); return 0; } - /* skip header */ - while (sp + 1 < buf + size && - !(sp[0] == '\n' && sp[1] == '\n')) - sp++; /* only take up to "lines" lines, and strip the signature */ for (i = 0, sp += 2; i < filter->lines && sp < buf + size &&