Skip to content

Commit 922fdef

Browse files
peffgitster
authored andcommitted
upload-pack: use repository struct to get config
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 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c2a3fd commit 922fdef

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

upload-pack.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,10 @@ static int upload_pack_protected_config(const char *var, const char *value,
13851385
return 0;
13861386
}
13871387

1388-
static void get_upload_pack_config(struct upload_pack_data *data)
1388+
static void get_upload_pack_config(struct repository *r,
1389+
struct upload_pack_data *data)
13891390
{
1390-
git_config(upload_pack_config, data);
1391+
repo_config(r, upload_pack_config, data);
13911392
git_protected_config(upload_pack_protected_config, data);
13921393
}
13931394

@@ -1398,7 +1399,7 @@ void upload_pack(const int advertise_refs, const int stateless_rpc,
13981399
struct upload_pack_data data;
13991400

14001401
upload_pack_data_init(&data);
1401-
get_upload_pack_config(&data);
1402+
get_upload_pack_config(the_repository, &data);
14021403

14031404
data.stateless_rpc = stateless_rpc;
14041405
data.timeout = timeout;
@@ -1771,7 +1772,7 @@ enum fetch_state {
17711772
FETCH_DONE,
17721773
};
17731774

1774-
int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
1775+
int upload_pack_v2(struct repository *r, struct packet_reader *request)
17751776
{
17761777
enum fetch_state state = FETCH_PROCESS_ARGS;
17771778
struct upload_pack_data data;
@@ -1780,7 +1781,7 @@ int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
17801781

17811782
upload_pack_data_init(&data);
17821783
data.use_sideband = LARGE_PACKET_MAX;
1783-
get_upload_pack_config(&data);
1784+
get_upload_pack_config(r, &data);
17841785

17851786
while (state != FETCH_DONE) {
17861787
switch (state) {

0 commit comments

Comments
 (0)