Re: [PATCH 1/2] connected: allow supplying different view of reachable objects
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 28, 2022, 18:12 UTC
- Message-ID
- <xmqqr0yrizqm.fsf@gitster.g>
- In-Reply-To
- <a32e3d6146dd41af36f525a744d6cc099b42d6fb.1666967670.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 23 quoted lines
> diff --git a/connected.c b/connected.c
> index 74a20cb32e..2a4c4e0025 100644
> --- a/connected.c
> +++ b/connected.c
> @@ -98,7 +98,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
> strvec_push(&rev_list.args, "--stdin");
> if (has_promisor_remote())
> strvec_push(&rev_list.args, "--exclude-promisor-objects");
> - if (!opt->is_deepening_fetch) {
> + if (!opt->is_deepening_fetch && !opt->reachable_oids_fn) {
> strvec_push(&rev_list.args, "--not");
> strvec_push(&rev_list.args, "--all");
> }
> @@ -125,6 +125,13 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
>
> rev_list_in = xfdopen(rev_list.in, "w");
>
> + if (opt->reachable_oids_fn) {
> + const struct object_id *reachable_oid;
> + while ((reachable_oid = opt->reachable_oids_fn(opt->reachable_oids_data)) != NULL)
> + if (fprintf(rev_list_in, "^%s\n", oid_to_hex(reachable_oid)) < 0)
> + break;
> + }It is good that these individual negative references are fed from the standard input, not on the command line, as they can be many.
In the original code without the reachable_oids_fn, we refrain from excluding when the is_deepening_fetch bit is set, but here we do not pay attention to the bit at all. Is that sensible, and if so why?