On Wed, Jun 25, 2008 at 05:01:01PM +0200, Lea Wiemann wrote: > Try the following on a repository with tag objects in it: > > git for-each-ref --format='%(object)' > git for-each-ref --format='%(type)' > > Each command prints only newlines. The %(type) and %(object) options are > not rejected with an error message (like "%(doesnotexist)"), but they > don't seem to be implemented. "%(tag)" works though. > > Anyone care to implement the missing options? Or should they rather be > removed from the documentation? Looks like they were part of the original set of atoms, but they just never ended up implemented. Clearly nobody has actually cared in the intervening time, but it is easy enough to add them. See below. Since you seem to be testing for-each-ref, maybe it would make sense to put together a test script that exercises each of the atoms? -- >8 -- 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@xxxxxxxx> --- builtin-for-each-ref.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 07d9c57..fef93d7 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -234,6 +234,13 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob name++; if (!strcmp(name, "tag")) v->s = tag->tag; + else if (!strcmp(name, "type") && tag->tagged) + v->s = typename(tag->tagged->type); + else if (!strcmp(name, "object") && tag->tagged) { + char *s = xmalloc(41); + strcpy(s, sha1_to_hex(tag->tagged->sha1)); + v->s = s; + } } } -- 1.5.6.129.g8dea5.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html