]> git.ipfire.org Git - thirdparty/git.git/commit
t/t5505-remote: set default branch to main
authorBence Ferdinandy <bence@ferdinandy.com>
Fri, 22 Nov 2024 12:28:42 +0000 (13:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Nov 2024 02:46:34 +0000 (11:46 +0900)
commit54d820d7d4fee3a231b6ecaeb2607cb8f817f74d
treeb5e27f18e3121e1a6d10ec454693747136846e2b
parente9356ba3ea2a6754281ff7697b3e5a1697b21e24
t/t5505-remote: set default branch to main

Consider the bare repository called "mirror" in the test. Running `git
remote add --mirror -f origin ../one` will not change HEAD, consequently
if init.defaultBranch is not the same as what HEAD in the remote
("one"), HEAD in "mirror" will be pointing to a non-existent reference.
Hence if "mirror" is used as a remote by yet another repository,
ls-remote will not show HEAD. On the other hand, if init.defaultBranch
happens to match HEAD in "one", then ls-remote will show HEAD.

Since the "ci/run-build-and-tests.sh" script globally exports
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main for some (but not all) jobs,
there may be a drift in some tests between how the test repositories are
set up in the CI and during local testing, if the test itself uses
"master" as default instead of "main". In particular, this happens in
t5505-remote.sh. This issue does not manifest currently, as the test
does not do any remote HEAD manipulation where this would come up, but
should such things be added, a locally passing test would break the CI
and vice-versa.

Set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main in t5505-remote to be
consistent with the CI.

Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5505-remote.sh