summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28de5b6)
raw | patch | inline | side by side (parent: 28de5b6)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 12 Apr 2010 23:25:28 +0000 (16:25 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 13 Apr 2010 04:45:17 +0000 (21:45 -0700) |
Just like with committer dates, we parse the tagger date into the
struct tag so its available for further downstream processing.
However since the tagger header was not introduced until Git 0.99.1
we must consider it optional. For tags missing this header we use
the default date of 0.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
struct tag so its available for further downstream processing.
However since the tagger header was not introduced until Git 0.99.1
we must consider it optional. For tags missing this header we use
the default date of 0.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tag.c | patch | blob | history | |
tag.h | patch | blob | history |
index ceb86557c5eedb03cbdc81929b7d109b44d440d5..85607c219e25d63b0d1f3344649104c60f5b96e2 100644 (file)
--- a/tag.c
+++ b/tag.c
return (struct tag *) obj;
}
+static unsigned long parse_tag_date(const char *buf, const char *tail)
+{
+ const char *dateptr;
+
+ while (buf < tail && *buf++ != '>')
+ /* nada */;
+ if (buf >= tail)
+ return 0;
+ dateptr = buf;
+ while (buf < tail && *buf++ != '\n')
+ /* nada */;
+ if (buf >= tail)
+ return 0;
+ /* dateptr < buf && buf[-1] == '\n', so strtoul will stop at buf-1 */
+ return strtoul(dateptr, NULL, 10);
+}
+
int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
{
unsigned char sha1[20];
item->tag = xmemdupz(bufptr, nl - bufptr);
bufptr = nl + 1;
+ if (!prefixcmp(bufptr, "tagger "))
+ item->date = parse_tag_date(bufptr, tail);
+ else
+ item->date = 0;
+
return 0;
}