Skip to content

Commit

Permalink
fetch-pack: use OBJECT_INFO_QUICK to avoid extra prepare_packed_git call
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takuto Ikuta authored and dscho committed Nov 28, 2017
1 parent 8ce23d0 commit ff4a783
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ff4a783

Please sign in to comment.