summaryrefslogtreecommitdiff
path: root/builtin/for-each-ref.c
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2010-08-26 17:34:29 -0400
committerJunio C Hamano <gitster@pobox.com>2010-08-26 16:42:25 -0700
commitea16a030aaaaebb3d0038e3ec2d9cd837985dee0 (patch)
tree16a834ed395a18a402613d93ccbfa17d074386c4 /builtin/for-each-ref.c
parent2244eab01bfef95621ab61d2d08a3d21ba1353cf (diff)
downloadgit-ea16a030aaaaebb3d0038e3ec2d9cd837985dee0.tar.gz
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>
Diffstat (limited to 'builtin/for-each-ref.c')
-rw-r--r--builtin/for-each-ref.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index a2b28c6962..89e75c6894 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));
}
}
}