Optimize sha1_object_info for loose objects, not concurrent repacks
commitddd63e64e4ac7e455dff3e807bf6a6977bb61456
authorSteven Grimm <koreth@midwinter.com>
Tue, 5 Aug 2008 20:08:41 +0000 (5 13:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Aug 2008 04:21:20 +0000 (5 21:21 -0700)
tree7aa1f68152ab489b540f9d4c742303c387c05e38
parent3d32a46b247222a97007419fa865efce959b002d
Optimize sha1_object_info for loose objects, not concurrent repacks

When dealing with a repository with lots of loose objects, sha1_object_info
would rescan the packs directory every time an unpacked object was referenced
before finally giving up and looking for the loose object. This caused a lot
of extra unnecessary system calls during git pack-objects; the code was
rereading the entire pack directory once for each loose object file.

This patch looks for a loose object before falling back to rescanning the
pack directory, rather than the other way around.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c