sha1_file: Show the the type and path to corrupt objects
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: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>