On Wed, Feb 28, 2024 at 05:46:47PM -0500, Jeff King wrote: > Our upload_pack_v2() function gets a repository struct, but we ignore it > totally. In practice this doesn't cause any problems, as it will never > differ from the_repository. But in the spirit of taking a small step > towards getting rid of the_repository, let's at least starting using it Nit: s/starting/start Patrick > to grab config. There are probably other spots that could benefit, but > it's a start. > > Note that we don't need to pass the repo for protected_config(); the > whole point there is that we are not looking at repo config, so there is > no repo-specific version of the function. > > For the v0 version of the protocol, we're not passed a repository > struct, so we'll continue to use the_repository there. > > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > upload-pack.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/upload-pack.c b/upload-pack.c > index 2537affa90..e156c1e472 100644 > --- a/upload-pack.c > +++ b/upload-pack.c > @@ -1385,9 +1385,10 @@ static int upload_pack_protected_config(const char *var, const char *value, > return 0; > } > > -static void get_upload_pack_config(struct upload_pack_data *data) > +static void get_upload_pack_config(struct repository *r, > + struct upload_pack_data *data) > { > - git_config(upload_pack_config, data); > + repo_config(r, upload_pack_config, data); > git_protected_config(upload_pack_protected_config, data); > } > > @@ -1398,7 +1399,7 @@ void upload_pack(const int advertise_refs, const int stateless_rpc, > struct upload_pack_data data; > > upload_pack_data_init(&data); > - get_upload_pack_config(&data); > + get_upload_pack_config(the_repository, &data); > > data.stateless_rpc = stateless_rpc; > data.timeout = timeout; > @@ -1771,7 +1772,7 @@ enum fetch_state { > FETCH_DONE, > }; > > -int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request) > +int upload_pack_v2(struct repository *r, struct packet_reader *request) > { > enum fetch_state state = FETCH_PROCESS_ARGS; > struct upload_pack_data data; > @@ -1780,7 +1781,7 @@ int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request) > > upload_pack_data_init(&data); > data.use_sideband = LARGE_PACKET_MAX; > - get_upload_pack_config(&data); > + get_upload_pack_config(r, &data); > > while (state != FETCH_DONE) { > switch (state) { > -- > 2.44.0.rc2.424.gbdbf4d014b > >
Attachment:
signature.asc
Description: PGP signature