Skip to content

Commit

Permalink
for-each-ref: fix objectname:short bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jay Soffian authored and Junio C Hamano committed Aug 26, 2010
1 parent 2244eab commit ea16a03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/for-each-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Expand Down

0 comments on commit ea16a03

Please sign in to comment.