@matheusbsbs / matheus-bagliano / commits / 87412ec1f1
Fork 0

for-each-ref: implement missing tag values

The "type" and "object" fields for tags were accepted as valid atoms, but never implemented. Consequently, they simply returned the empty string, even for valid tags. Noticed by Lea Wiemann. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 25, 2008 at 12:08 UTC 87412ec1f17bc2705595ebabc010d94cb46478b7
1 file changed +7
builtin-for-each-ref.c
+7
@@ -234,6 +234,13 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
234 name++;
235 if (!strcmp(name, "tag"))
236 v->s = tag->tag;
237 + else if (!strcmp(name, "type") && tag->tagged)
238 + v->s = typename(tag->tagged->type);
239 + else if (!strcmp(name, "object") && tag->tagged) {
240 + char *s = xmalloc(41);
241 + strcpy(s, sha1_to_hex(tag->tagged->sha1));
242 + v->s = s;
243 + }
244 }
245 }
246