1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-12 23:06:56 +02:00

Small code readability improvement in show_reference() in builtin-tag.c

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Mike Hommey 2007-11-03 14:08:05 +01:00 committed by Junio C Hamano
parent 620bb245b9
commit e1f14cce69

View File

@ -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 &&