tests: pin scratch repos to master regardless of init.defaultBranch
PATCH 1/1 tests: pin scratch repos to master regardless of init.defaultBranch
From: Hangbin Liu <[email protected]>
_init_repo() ran a plain "git init", so the scratch repo's initial branch followed the developer's init.defaultBranch. On a machine configured with init.defaultBranch=main (increasingly the norm), the repos come up on main, and test_base_commit_in_remote_tree then fails at its "git checkout master".
Pins -b master on the local side so the suite passes regardless of the developer's default-branch configuration.
Assisted-by LLM [analysis, codegen]
Fixes 4ee47be995f2 ("ty: verify queued-thanks commits by ref reachability, not HTTP status")
Signed-off-by Hangbin Liu <[email protected]>
--- src/tests/test_ty.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/tests/test_ty.py +3 -1
@@ -401,7 +401,9 @@ def test_get_check_repo_config_override(monkeypatch: pytest.MonkeyPatch) -> None def _init_repo(path: str) -> None: - ecode, out = b4.git_run_command(None, ['init', path]) + # -b master: some tests check out "master" by name, and an + # init.defaultBranch of 'main' would leave no such branch to find. + ecode, out = b4.git_run_command(None, ['init', '-b', 'master', path]) assert ecode == 0, out b4.git_set_config(path, 'user.name', 'Test') b4.git_set_config(path, 'user.email', '[email protected]')
---
base-commit: 6be7c6139d7734d84afddf989fa2874935b6d85b
change-id: 20261020-test_base_commit-d258e41c094a
Best regards,
Signature · 1 line
Hangbin Liu <[email protected]>