Skip to content

Commit 1754c81

Browse files
Takuto Ikutadscho
authored andcommitted
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/[email protected]/ Signed-off-by: Takuto Ikuta <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6ea0daa commit 1754c81

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fetch-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ static int everything_local(struct fetch_pack_args *args,
716716
for (ref = *refs; ref; ref = ref->next) {
717717
struct object *o;
718718

719-
if (!has_object_file(&ref->old_oid))
719+
if (!has_object_file_with_flags(&ref->old_oid,
720+
OBJECT_INFO_QUICK))
720721
continue;
721722

722723
o = parse_object(&ref->old_oid);

0 commit comments

Comments
 (0)