+ while (*t == '\n')
+ t++;
+ ret->msg = xstrdup(t);
+
+ reencode(&ret->author, ret->msg_encoding, PAGE_ENCODING);
+ reencode(&ret->author_email, ret->msg_encoding, PAGE_ENCODING);
+ reencode(&ret->committer, ret->msg_encoding, PAGE_ENCODING);
+ reencode(&ret->committer_email, ret->msg_encoding, PAGE_ENCODING);
+ reencode(&ret->subject, ret->msg_encoding, PAGE_ENCODING);
+ reencode(&ret->msg, ret->msg_encoding, PAGE_ENCODING);
+
+ return ret;
+}
+
+struct taginfo *cgit_parse_tag(struct tag *tag)
+{
+ void *data;
+ enum object_type type;
+ unsigned long size;
+ const char *p;
+ struct taginfo *ret = NULL;
+
+ data = read_sha1_file(tag->object.oid.hash, &type, &size);
+ if (!data || type != OBJ_TAG)
+ goto cleanup;
+
+ ret = xcalloc(1, sizeof(struct taginfo));
+
+ for (p = data; !end_of_header(p); p = next_header_line(p)) {
+ if (skip_prefix(p, "tagger ", &p)) {
+ parse_user(p, &ret->tagger, &ret->tagger_email,
+ &ret->tagger_date, &ret->tagger_tz);
+ }
+ }
+
+ while (p && *p == '\n')
+ p++;