]> git.ipfire.org Git - thirdparty/git.git/commit - cache.h
find_unique_abbrev: use 4-buffer ring
authorJeff King <peff@peff.net>
Thu, 20 Oct 2016 06:19:19 +0000 (02:19 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2016 20:30:51 +0000 (13:30 -0700)
commitef2ed5013c4160284d9de18903bd4f7d0542d810
tree6c11907a3c953aa672bfe70534fec122c22e4744
parent4ce742fc9c09cd3b95be309bc093f8fa54c15f96
find_unique_abbrev: use 4-buffer ring

Some code paths want to format multiple abbreviated sha1s in
the same output line. Because we use a single static buffer
for our return value, they have to either break their output
into several calls or allocate their own arrays and use
find_unique_abbrev_r().

Intead, let's mimic sha1_to_hex() and use a ring of several
buffers, so that the return value stays valid through
multiple calls. This shortens some of the callers, and makes
it harder to for them to make a silly mistake.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge.c
builtin/receive-pack.c
cache.h
sha1_name.c