From 1754c8135833855eeb5b163c2f6025ea25034719 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Sun, 26 Nov 2017 13:01:04 +0900 Subject: [PATCH] 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 Signed-off-by: Johannes Schindelin --- fetch-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fetch-pack.c b/fetch-pack.c index 008b25d3db..9f6b07ad91 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -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);