]> asedeno.scripts.mit.edu Git - git.git/commitdiff
for-each-ref: fix objectname:short bug
authorJay Soffian <jaysoffian@gmail.com>
Thu, 26 Aug 2010 21:34:29 +0000 (17:34 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 Aug 2010 23:42:25 +0000 (16:42 -0700)
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>
builtin/for-each-ref.c

index a2b28c6962be8ea6f8882bae3d4fde9d972e78d2..89e75c6894e6fdb2abbe464d825f5c7186a14141 100644 (file)
@@ -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));
                }
        }
 }