зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
3c2a3fdc38
Коммит
922fdefb84
|
@ -1385,9 +1385,10 @@ static int upload_pack_protected_config(const char *var, const char *value,
|
||||||
return 0;
|
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);
|
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;
|
struct upload_pack_data data;
|
||||||
|
|
||||||
upload_pack_data_init(&data);
|
upload_pack_data_init(&data);
|
||||||
get_upload_pack_config(&data);
|
get_upload_pack_config(the_repository, &data);
|
||||||
|
|
||||||
data.stateless_rpc = stateless_rpc;
|
data.stateless_rpc = stateless_rpc;
|
||||||
data.timeout = timeout;
|
data.timeout = timeout;
|
||||||
|
@ -1771,7 +1772,7 @@ enum fetch_state {
|
||||||
FETCH_DONE,
|
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;
|
enum fetch_state state = FETCH_PROCESS_ARGS;
|
||||||
struct upload_pack_data data;
|
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);
|
upload_pack_data_init(&data);
|
||||||
data.use_sideband = LARGE_PACKET_MAX;
|
data.use_sideband = LARGE_PACKET_MAX;
|
||||||
get_upload_pack_config(&data);
|
get_upload_pack_config(r, &data);
|
||||||
|
|
||||||
while (state != FETCH_DONE) {
|
while (state != FETCH_DONE) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче