Skip to content

Commit 2df1aa2

Browse files
jonathantanmygitster
authored andcommitted
fetch: forgo full connectivity check if --filter
If a filter is specified, we do not need a full connectivity check on the contents of the packfile we just fetched; we only need to check that the objects referenced are promisor objects. This significantly speeds up fetches into repositories that have many promisor objects, because during the connectivity check, all promisor objects are enumerated (to mark them UNINTERESTING), and that takes a significant amount of time. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5003377 commit 2df1aa2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

builtin/fetch.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,17 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
906906
url = xstrdup("foreign");
907907

908908
if (!connectivity_checked) {
909+
struct check_connected_options opt = CHECK_CONNECTED_INIT;
910+
911+
if (filter_options.choice)
912+
/*
913+
* Since a filter is specified, objects indirectly
914+
* referenced by refs are allowed to be absent.
915+
*/
916+
opt.check_refs_are_promisor_objects_only = 1;
917+
909918
rm = ref_map;
910-
if (check_connected(iterate_ref_map, &rm, NULL)) {
919+
if (check_connected(iterate_ref_map, &rm, &opt)) {
911920
rc = error(_("%s did not send all necessary objects\n"), url);
912921
goto abort;
913922
}

0 commit comments

Comments
 (0)