read_sha1_file(): report correct name of packfile with a corrupt object
commitb6c4ceccb3d6026c612fa55865c51374b26eb176
authorJunio C Hamano <gitster@pobox.com>
Thu, 28 Oct 2010 18:13:06 +0000 (28 11:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Nov 2010 16:24:47 +0000 (3 09:24 -0700)
tree22a224dc90c5eae4684aaf363cc25a8ac616685a
parent87b50542a08ac6caa083ddc376e674424e37940a
read_sha1_file(): report correct name of packfile with a corrupt object

Clarify the error reporting logic by moving the normal codepath (i.e. we
read the object we wanted to read correctly) up and return early.

The logic to report the name of the packfile with a corrupt object,
introduced by e8b15e6 (sha1_file: Show the the type and path to corrupt
objects, 2010-06-10), was totally bogus.  The function that knows which
bad object came from what packfile is has_packed_and_bad(); make it report
which packfile the problem was found.

"Corrupt" is already an adjective, e.g. an object is "corrupt"; we do not
have to say "corrupted object".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c