Skip to content

Commit

Permalink
Small code readability improvement in show_reference() in builtin-tag.c
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
glandium authored and gitster committed Nov 8, 2007
1 parent 620bb24 commit e1f14cc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions builtin-tag.c
Expand Up @@ -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 &&
Expand Down

0 comments on commit e1f14cc

Please sign in to comment.