X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-tag.c;h=cbb0f04e85627a5509bb2ba8cbf04a54d4d20c41;hb=d577bc58a3424f4d0d7f7c8094753b92cb7cb823;hp=566d123a8db1a3da70d261acd8cf3fdcbc2e469f;hpb=bab8118aff7581364eb5c74472fe7ab4f45f4a12;p=git.git diff --git a/builtin-tag.c b/builtin-tag.c index 566d123a8..cbb0f04e8 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 &&