fetch-pack: use OBJECT_INFO_QUICK to avoid extra prepare_packed_git call

When I run git fetch, git tries to find object for each local and remote
refs.  Without specifying OBJECT_INFO_QUICK, has_object_file list up
entries in pack directory for each calls.

This patch makes git fetch fast for the repositories having large number
of refs, especially for windows because it's directory list up api is
much slower than linux.

Note: this patch was developed independently also by Jeff King:
https://public-inbox.org/git/20171120202920.7ppcwmzkxifywtoj@sigill.intra.peff.net/

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Takuto Ikuta
2017-11-26 13:01:04 +09:00
committed by Johannes Schindelin
parent 8ce23d0a3b
commit ff4a78355c

View File

@@ -716,7 +716,8 @@ static int everything_local(struct fetch_pack_args *args,
for (ref = *refs; ref; ref = ref->next) {
struct object *o;
if (!has_object_file(&ref->old_oid))
if (!has_object_file_with_flags(&ref->old_oid,
OBJECT_INFO_QUICK))
continue;
o = parse_object(&ref->old_oid);