sha1_object_info(): be consistent with read_sha1_file()
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Mon, 27 Nov 2006 23:18:55 +0000 (00:18 +0100)
committerJunio C Hamano <junkio@cox.net>
Tue, 28 Nov 2006 00:56:54 +0000 (16:56 -0800)
commitf0df4ed5629c25e9978708115ad654b9f83f55df
treef0fe42646e119da881b57d642a816b937553007c
parent1d541c120b4de5c70e73f8a20e1d961324cc55fe
sha1_object_info(): be consistent with read_sha1_file()

We used to try loose objects first with sha1_object_info(), but packed
objects first with read_sha1_file(). Now, prefer packed objects over loose
ones with sha1_object_info(), too.

Usually the old behaviour would pose no problem, but when you tried to fix
a fscked up repository by inserting a known-good pack,

git cat-file $(git cat-file -t <sha1>) <sha1>

could fail, even when

git cat-file blob <sha1>

would _not_ fail. Worse, a repack would fail, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c