From 67687feae52ff2d3ab7edf3ac42a39c5e44be299 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Thu, 13 May 2010 14:31:46 +0200 Subject: for-each-ref: Field with abbreviated objectname Introduce a :short modifier to objectname which outputs the abbreviated object name. Signed-off-by: Michael J Gruber Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/for-each-ref.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin/for-each-ref.c') diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 62be1bbfd6..3a97953177 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -227,6 +227,9 @@ static void grab_common_values(struct atom_value *val, int deref, struct object strcpy(s, sha1_to_hex(obj->sha1)); v->s = s; } + else if (!strcmp(name, "objectname:short")) { + v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV); + } } } -- cgit v1.2.1