Skip to content

Commit 09ccec4

Browse files
author
Takuto Ikuta
committed
enable fscache while iterating every local refs
When I do git fetch, git reads entries in .git/objects/pack for every refs in local repository. By enabling fscache, directory list up in .git/objects/pack for each refs is cached. Without fscache, such behavior causes long running time when we do git fetch in local repository having many refs. This patch improves execution time in such case, especially in very large repository like chromium. In my windows workstation, this patch improves git fetch time from more than 3 minutes to less than 20 seconds for chromium repository. Signed-off-by: Takuto Ikuta <[email protected]>
1 parent 8ce23d0 commit 09ccec4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fetch-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ static int everything_local(struct fetch_pack_args *args,
713713

714714
save_commit_buffer = 0;
715715

716+
enable_fscache(1);
716717
for (ref = *refs; ref; ref = ref->next) {
717718
struct object *o;
718719

@@ -733,6 +734,7 @@ static int everything_local(struct fetch_pack_args *args,
733734
cutoff = commit->date;
734735
}
735736
}
737+
enable_fscache(0);
736738

737739
if (!args->deepen) {
738740
for_each_ref(mark_complete_oid, NULL);

0 commit comments

Comments
 (0)