tests: define GIT_TEST_SIDEBAND_ALL

Define a GIT_TEST_SIDEBAND_ALL environment variable meant to be used
from tests. When set to true, this overrides uploadpack.allowsidebandall
to true, allowing the entire test suite to be run as if this
configuration is in place for all repositories.

As of this patch, all tests pass whether GIT_TEST_SIDEBAND_ALL is unset
or set to 1.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Tan
2019-01-16 11:28:15 -08:00
committed by Junio C Hamano
parent 0bbc0bc574
commit 07c3c2aa16
7 changed files with 21 additions and 10 deletions

View File

@ -1288,7 +1288,9 @@ static void process_args(struct packet_reader *request,
continue;
}
if (allow_sideband_all && !strcmp(arg, "sideband-all")) {
if ((git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
allow_sideband_all) &&
!strcmp(arg, "sideband-all")) {
data->writer.use_sideband = 1;
continue;
}
@ -1521,10 +1523,11 @@ int upload_pack_advertise(struct repository *r,
allow_ref_in_want)
strbuf_addstr(value, " ref-in-want");
if (!repo_config_get_bool(the_repository,
"uploadpack.allowsidebandall",
&allow_sideband_all_value) &&
allow_sideband_all_value)
if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
(!repo_config_get_bool(the_repository,
"uploadpack.allowsidebandall",
&allow_sideband_all_value) &&
allow_sideband_all_value))
strbuf_addstr(value, " sideband-all");
}