Merge branch 'jh/fsck-promisors'
In preparation for implementing narrow/partial clone, the machinery for checking object connectivity used by gc and fsck has been taught that a missing object is OK when it is referenced by a packfile specially marked as coming from trusted repository that promises to make them available on-demand and lazily. * jh/fsck-promisors: gc: do not repack promisor packfiles rev-list: support termination at promisor objects sha1_file: support lazily fetching missing objects introduce fetch-object: fetch one promisor object index-pack: refactor writing of .keep files fsck: support promisor objects as CLI argument fsck: support referenced promisor objects fsck: support refs pointing to promisor objects fsck: introduce partialclone extension extension.partialclone: introduce partial clone extension
This commit is contained in:
48
fetch-pack.c
48
fetch-pack.c
@ -450,6 +450,8 @@ static int find_common(struct fetch_pack_args *args,
|
||||
|
||||
flushes = 0;
|
||||
retval = -1;
|
||||
if (args->no_dependents)
|
||||
goto done;
|
||||
while ((oid = get_rev())) {
|
||||
packet_buf_write(&req_buf, "have %s\n", oid_to_hex(oid));
|
||||
print_verbose(args, "have %s", oid_to_hex(oid));
|
||||
@ -735,29 +737,31 @@ static int everything_local(struct fetch_pack_args *args,
|
||||
}
|
||||
}
|
||||
|
||||
if (!args->deepen) {
|
||||
for_each_ref(mark_complete_oid, NULL);
|
||||
for_each_cached_alternate(mark_alternate_complete);
|
||||
commit_list_sort_by_date(&complete);
|
||||
if (cutoff)
|
||||
mark_recent_complete_commits(args, cutoff);
|
||||
}
|
||||
if (!args->no_dependents) {
|
||||
if (!args->deepen) {
|
||||
for_each_ref(mark_complete_oid, NULL);
|
||||
for_each_cached_alternate(mark_alternate_complete);
|
||||
commit_list_sort_by_date(&complete);
|
||||
if (cutoff)
|
||||
mark_recent_complete_commits(args, cutoff);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark all complete remote refs as common refs.
|
||||
* Don't mark them common yet; the server has to be told so first.
|
||||
*/
|
||||
for (ref = *refs; ref; ref = ref->next) {
|
||||
struct object *o = deref_tag(lookup_object(ref->old_oid.hash),
|
||||
NULL, 0);
|
||||
/*
|
||||
* Mark all complete remote refs as common refs.
|
||||
* Don't mark them common yet; the server has to be told so first.
|
||||
*/
|
||||
for (ref = *refs; ref; ref = ref->next) {
|
||||
struct object *o = deref_tag(lookup_object(ref->old_oid.hash),
|
||||
NULL, 0);
|
||||
|
||||
if (!o || o->type != OBJ_COMMIT || !(o->flags & COMPLETE))
|
||||
continue;
|
||||
if (!o || o->type != OBJ_COMMIT || !(o->flags & COMPLETE))
|
||||
continue;
|
||||
|
||||
if (!(o->flags & SEEN)) {
|
||||
rev_list_push((struct commit *)o, COMMON_REF | SEEN);
|
||||
if (!(o->flags & SEEN)) {
|
||||
rev_list_push((struct commit *)o, COMMON_REF | SEEN);
|
||||
|
||||
mark_common((struct commit *)o, 1, 1);
|
||||
mark_common((struct commit *)o, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -833,7 +837,7 @@ static int get_pack(struct fetch_pack_args *args,
|
||||
argv_array_push(&cmd.args, alternate_shallow_file);
|
||||
}
|
||||
|
||||
if (do_keep) {
|
||||
if (do_keep || args->from_promisor) {
|
||||
if (pack_lockfile)
|
||||
cmd.out = -1;
|
||||
cmd_name = "index-pack";
|
||||
@ -843,7 +847,7 @@ static int get_pack(struct fetch_pack_args *args,
|
||||
argv_array_push(&cmd.args, "-v");
|
||||
if (args->use_thin_pack)
|
||||
argv_array_push(&cmd.args, "--fix-thin");
|
||||
if (args->lock_pack || unpack_limit) {
|
||||
if (do_keep && (args->lock_pack || unpack_limit)) {
|
||||
char hostname[HOST_NAME_MAX + 1];
|
||||
if (xgethostname(hostname, sizeof(hostname)))
|
||||
xsnprintf(hostname, sizeof(hostname), "localhost");
|
||||
@ -853,6 +857,8 @@ static int get_pack(struct fetch_pack_args *args,
|
||||
}
|
||||
if (args->check_self_contained_and_connected)
|
||||
argv_array_push(&cmd.args, "--check-self-contained-and-connected");
|
||||
if (args->from_promisor)
|
||||
argv_array_push(&cmd.args, "--promisor");
|
||||
}
|
||||
else {
|
||||
cmd_name = "unpack-objects";
|
||||
|
||||
Reference in New Issue
Block a user