Skip to content
  • Jeff King's avatar
    find_unique_abbrev: use 4-buffer ring · ef2ed501
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ef2ed501