aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-02-28 17:46:47 -0500
committerJunio C Hamano <gitster@pobox.com>2024-02-28 14:48:35 -0800
commit922fdefb84c4341c0bb10f3ca090725f9fcc8bcb (patch)
tree3dd2829caa24a5fe301b49e2f271c8f064617a02
parent3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0 (diff)
downloadgit-922fdefb84c4341c0bb10f3ca090725f9fcc8bcb.tar.gz
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--upload-pack.c11
1 files 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) {