From ea16a030aaaaebb3d0038e3ec2d9cd837985dee0 Mon Sep 17 00:00:00 2001 From: Jay Soffian Date: Thu, 26 Aug 2010 17:34:29 -0400 Subject: for-each-ref: fix objectname:short bug When objectname:short was introduced, it forgot to copy the result of find_unique_abbrev. Because the result of find_unique_abbrev is a pointer to static buffer, this resulted in the same value being substituted in for each ref. Signed-off-by: Jay Soffian Acked-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index a2b28c6..89e75c6 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -228,7 +228,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct object v->s = s; } else if (!strcmp(name, "objectname:short")) { - v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV); + v->s = xstrdup(find_unique_abbrev(obj->sha1, + DEFAULT_ABBREV)); } } } -- cgit v0.10.2-6-g49f6