Jay Soffian  committed ea16a03

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 <>

  • Participants
  • Parent commits 2244eab

Comments (0)

Files changed (1)

File builtin/for-each-ref.c

 			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));