Skip to content
  • Jeff King's avatar
    blame: handle --no-abbrev · ed58d808
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    You can already ask blame for full sha1s with "-l" or with
    "--abbrev=40". But for consistency with other parts of Git,
    we should support "--no-abbrev".
    
    Worse, blame already accepts --no-abbrev, but it's totally
    broken. When we see --no-abbrev, the abbrev variable is set
    to 0, which is then used as a printf precision. For regular
    sha1s, that means we print nothing at all (which is very
    wrong). For boundary commits we decrement it to "-1", which
    printf interprets as "no limit" (which is almost correct,
    except it misses the 39-length magic explained in the
    previous commit).
    
    Let's detect --no-abbrev and behave as if --abbrev=40 was
    given.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ed58d808