Skip to content

Commit 0c60105

Browse files
committed
Merge branch 'jt/connectivity-check-optim-in-partial-clone'
Simplify the commit ancestry connectedness check in a partial clone repository in which "promised" objects are assumed to be obtainable lazily on-demand from promisor remote repositories. * jt/connectivity-check-optim-in-partial-clone: connected: always use partial clone optimization
2 parents 06aaafb + 2b98478 commit 0c60105

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

builtin/clone.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,7 @@ static void update_remote_refs(const struct ref *refs,
676676
const char *branch_top,
677677
const char *msg,
678678
struct transport *transport,
679-
int check_connectivity,
680-
int check_refs_are_promisor_objects_only)
679+
int check_connectivity)
681680
{
682681
const struct ref *rm = mapped_refs;
683682

@@ -686,8 +685,6 @@ static void update_remote_refs(const struct ref *refs,
686685

687686
opt.transport = transport;
688687
opt.progress = transport->progress;
689-
opt.check_refs_are_promisor_objects_only =
690-
!!check_refs_are_promisor_objects_only;
691688

692689
if (check_connected(iterate_ref_map, &rm, &opt))
693690
die(_("remote did not send all necessary objects"));
@@ -1282,7 +1279,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
12821279

12831280
update_remote_refs(refs, mapped_refs, remote_head_points_at,
12841281
branch_top.buf, reflog_msg.buf, transport,
1285-
!is_local, filter_options.choice);
1282+
!is_local);
12861283

12871284
update_head(our_head_points_at, remote_head, reflog_msg.buf);
12881285

builtin/fetch.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -908,13 +908,6 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
908908
if (!connectivity_checked) {
909909
struct check_connected_options opt = CHECK_CONNECTED_INIT;
910910

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-
918911
rm = ref_map;
919912
if (check_connected(iterate_ref_map, &rm, &opt)) {
920913
rc = error(_("%s did not send all necessary objects\n"), url);

connected.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
5252
strbuf_release(&idx_file);
5353
}
5454

55-
if (opt->check_refs_are_promisor_objects_only) {
55+
if (has_promisor_remote()) {
5656
/*
5757
* For partial clones, we don't want to have to do a regular
5858
* connectivity check because we have to enumerate and exclude
@@ -75,13 +75,18 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
7575
if (find_pack_entry_one(oid.hash, p))
7676
goto promisor_pack_found;
7777
}
78-
return 1;
78+
/*
79+
* Fallback to rev-list with oid and the rest of the
80+
* object IDs provided by fn.
81+
*/
82+
goto no_promisor_pack_found;
7983
promisor_pack_found:
8084
;
8185
} while (!fn(cb_data, &oid));
8286
return 0;
8387
}
8488

89+
no_promisor_pack_found:
8590
if (opt->shallow_file) {
8691
argv_array_push(&rev_list.args, "--shallow-file");
8792
argv_array_push(&rev_list.args, opt->shallow_file);

connected.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ struct check_connected_options {
4646
* during a fetch.
4747
*/
4848
unsigned is_deepening_fetch : 1;
49-
50-
/*
51-
* If non-zero, only check that the top-level objects referenced by the
52-
* wanted refs (passed in as cb_data) are promisor objects. This is
53-
* useful for partial clones, where enumerating and excluding all
54-
* promisor objects is very slow and the commit-walk itself becomes a
55-
* no-op.
56-
*/
57-
unsigned check_refs_are_promisor_objects_only : 1;
5849
};
5950

6051
#define CHECK_CONNECTED_INIT { 0 }

0 commit comments

Comments
 (0)