Re: [PATCH 04/13] odb: refactor `odb_for_each_alternate()` to yield dirs
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 6, 2026, 08:42 UTC
- Message-ID
- <CAOLa=ZT-=VQNXBs=i8ZkB1yZoJV_i_n90S+Ygdgt5=tmquVOOA@mail.gmail.com>
- In-Reply-To
- <20261002-pks-odb-move-alternates-v1-4-8a63507b88c4@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 25 quoted lines
> @@ -468,9 +470,11 @@ static int refs_from_alternate_cb(struct odb_source *alternate,
> void odb_for_each_alternate_ref(struct object_database *odb,
> odb_for_each_alternate_ref_fn cb, void *payload)
> {
> - struct alternate_refs_data data;
> - data.fn = cb;
> - data.payload = payload;
> + struct alternate_refs_data data = {
> + .fn = cb,
> + .payload = payload,
> + .repo = odb->repo,
> + };
> odb_for_each_alternate(odb, refs_from_alternate_cb, &data);
> }
>
> @@ -481,7 +485,7 @@ int odb_for_each_alternate(struct object_database *odb,
> int r = 0;
>
> for (alternate = odb->sources->next; alternate; alternate = alternate->next) {
> - r = cb(alternate, payload);
> + r = cb(odb_source_files_downcast(alternate)->dirs, payload);
> if (r)
> break;
> }
>Okay, so here we call the callbacks with the `dirs` now and this corresponds with the changes in the rest of the patch. Makes sense.
[snip]