@matheusbsbs / matheus-bagliano / commits / ea16a030aa
Fork 0

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 <jaysoffian@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jay Soffian committed Aug 26, 2010 at 17:34 UTC ea16a030aaaaebb3d0038e3ec2d9cd837985dee0
1 file changed +2 -1
builtin/for-each-ref.c
+2 -1
@@ -228,7 +228,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
228 v->s = s;
229 }
230 else if (!strcmp(name, "objectname:short")) {
231 - v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV);
231 + v->s = xstrdup(find_unique_abbrev(obj->sha1,
232 + DEFAULT_ABBREV));
233 }
234 }
235 }