summaryrefslogtreecommitdiff
path: root/connected.c
diff options
context:
space:
mode:
Diffstat (limited to 'connected.c')
-rw-r--r--connected.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/connected.c b/connected.c
index 7e9bd1b..937b4ba 100644
--- a/connected.c
+++ b/connected.c
@@ -43,16 +43,18 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
if (transport && transport->smart_options &&
transport->smart_options->self_contained_and_connected &&
- transport->pack_lockfile &&
- strip_suffix(transport->pack_lockfile, ".keep", &base_len)) {
+ transport->pack_lockfiles.nr == 1 &&
+ strip_suffix(transport->pack_lockfiles.items[0].string,
+ ".keep", &base_len)) {
struct strbuf idx_file = STRBUF_INIT;
- strbuf_add(&idx_file, transport->pack_lockfile, base_len);
+ strbuf_add(&idx_file, transport->pack_lockfiles.items[0].string,
+ base_len);
strbuf_addstr(&idx_file, ".idx");
new_pack = add_packed_git(idx_file.buf, idx_file.len, 1);
strbuf_release(&idx_file);
}
- if (opt->check_refs_are_promisor_objects_only) {
+ if (has_promisor_remote()) {
/*
* For partial clones, we don't want to have to do a regular
* connectivity check because we have to enumerate and exclude
@@ -61,7 +63,11 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
* object is a promisor object. Instead, just make sure we
* received, in a promisor packfile, the objects pointed to by
* each wanted ref.
+ *
+ * Before checking for promisor packs, be sure we have the
+ * latest pack-files loaded into memory.
*/
+ reprepare_packed_git(the_repository);
do {
struct packed_git *p;
@@ -71,13 +77,18 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
if (find_pack_entry_one(oid.hash, p))
goto promisor_pack_found;
}
- return 1;
+ /*
+ * Fallback to rev-list with oid and the rest of the
+ * object IDs provided by fn.
+ */
+ goto no_promisor_pack_found;
promisor_pack_found:
;
} while (!fn(cb_data, &oid));
return 0;
}
+no_promisor_pack_found:
if (opt->shallow_file) {
argv_array_push(&rev_list.args, "--shallow-file");
argv_array_push(&rev_list.args, opt->shallow_file);