@matheusbsbs / matheus-bagliano / commits / 2df1aa239c
Fork 0

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>

Jonathan Tan committed Jan 11, 2020 at 20:15 UTC 2df1aa239cd50698ab3e0c2cb18b9c1d2f0e44d7
1 file changed +10 -1
builtin/fetch.c
+10 -1
@@ -906,8 +906,17 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
906 url = xstrdup("foreign");
907
908 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 +
918 rm = ref_map;
910 - if (check_connected(iterate_ref_map, &rm, NULL)) {
919 + if (check_connected(iterate_ref_map, &rm, &opt)) {
920 rc = error(_("%s did not send all necessary objects\n"), url);
921 goto abort;
922 }