Browse Source

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>
maint
Jay Soffian 15 years ago committed by Junio C Hamano
parent
commit
ea16a030aa
  1. 3
      builtin/for-each-ref.c

3
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; v->s = s;
} }
else if (!strcmp(name, "objectname:short")) { 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));
} }
} }
} }

Loading…
Cancel
Save