summaryrefslogtreecommitdiff
path: root/builtin-tag.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2007-11-03 13:08:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-08 01:25:47 (GMT)
commite1f14cce694602ca879bea03d143add1c18dff52 (patch)
tree2d0197ba3aaa237da5d96a765a51858bb6815687 /builtin-tag.c
parent620bb245b945531bb6e08016d5f28caf9e797786 (diff)
downloadgit-e1f14cce694602ca879bea03d143add1c18dff52.zip
git-e1f14cce694602ca879bea03d143add1c18dff52.tar.gz
git-e1f14cce694602ca879bea03d143add1c18dff52.tar.bz2
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>
Diffstat (limited to 'builtin-tag.c')
-rw-r--r--builtin-tag.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin-tag.c b/builtin-tag.c
index 66e5a58..4aca3dc 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 &&