Skip to content
  • Ævar Arnfjörð Bjarmason's avatar
    sha1_file: Show the the type and path to corrupt objects · e8b15e61
    Ævar Arnfjörð Bjarmason authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Change the error message that's displayed when we encounter corrupt
    objects to be more specific. We now print the type (loose or packed)
    of corrupted objects, along with the full path to the file in
    question.
    
    Before:
    
        $ git cat-file blob 909ef997367880aaf2133bafa1f1a71aa28e09df
        fatal: object 909ef997367880aaf2133bafa1f1a71aa28e09df is corrupted
    
    After:
    
        $ git cat-file blob 909ef997367880aaf2133bafa1f1a71aa28e09df
        fatal: loose object 909ef997367880aaf2133bafa1f1a71aa28e09df (stored in .git/objects/90/9ef997367880aaf2133bafa1f1a71aa28e09df) is corrupted
    
    Knowing the path helps to quickly analyze what's wrong:
    
        $ file .git/objects/90/9ef997367880aaf2133bafa1f1a71aa28e09df
        .git/objects/90/9ef997367880aaf2133bafa1f1a71aa28e09df: empty
    
    Signed-off-by: default avatarÆvar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    e8b15e61