Re: [Outreachy PATCH] negotiator/default: stop using the_repository
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Nov 3, 2026, 11:50 UTC
- Message-ID
- <CAP8UFD1BW7qEWp87j+7B12d=eOu80Yv1=Gf+ibEriV9s=4umag@mail.gmail.com>
- In-Reply-To
- <20261027153429.14131-1-okhuomonajayi54@gmail.com>
On Tue, Oct 27, 2026 at 4:37 PM Okhuomon Ajayi <okhuomonajayi54@gmail.com> wrote:
Show 8 quoted lines
> static void have_sent(struct fetch_negotiator *n, struct commit *c)
> {
> - if (repo_parse_commit(the_repository, c))
> + struct negotiation_state *ns = n->data;
> +
> + if (repo_parse_commit(ns->repo, c))
> return;
> mark_common(n->data, c, 0, 0);As you introduced `ns`, you might use it to simplify the above line using:
mark_common(ns, c, 0, 0);
> }
[...]
> -void default_negotiator_init(struct fetch_negotiator *negotiator); > +void default_negotiator_init(struct fetch_negotiator *negotiator, > + struct repository *r);
Many functions have their `struct repository *r` argument as their first argument. Is there a reason why you prefered to have it as the second argument?
Thanks.