sha1_file: Show the the type and path to corrupt objects
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 10 Jun 2010 12:47:01 +0000 (12:47 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Jul 2010 22:35:12 +0000 (15:35 -0700)
commite8b15e6156fc361d3cb0e093747dab840d58fc7e
treeabe35e3b729a5a7046ad481635be467f528f0b90
parentfc051572a3fe171286f10761bd33946c48de3f7f
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>
sha1_file.c