[PATCH 2/2] Small code readability improvement in show_reference() in builtin-tag.c
Signed-off-by: Mike Hommey <mh@glandium.org>
---
builtin-tag.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index e57f57f..3ed5759 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -84,14 +84,13 @@ static int show_reference(const char *refname, const unsigned char *sha1,
sp = buf = read_sha1_file(sha1, &type, &size);
if (!buf)
return 0;
- if (!size) {
+ /* skip header */
+ sp = strstr(buf, "\n\n");
+
+ if (!sp || !size) {
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 &&
--
1.5.3.5