Skip to content
  • Jeff King's avatar
    name-rev: replace static buffer with strbuf · 903fc7da
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When name-rev needs to format an actual name, we do so into
    a fixed-size buffer. That includes the actual ref tip, as
    well as any traversal information. Since refs can exceed
    1024 bytes, this means you can get a bogus result. E.g.,
    doing:
    
       git tag $(perl -e 'print join("/", 1..1024)')
       git describe --contains HEAD^
    
    results in ".../282/283", when it should be
    ".../1023/1024~1".
    
    We can solve this by using a heap buffer. We'll use a
    strbuf, which lets us write into the same buffer from our
    loop without having to reallocate.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    903fc7da