[PATCH b4 23/27] tests: pin the default branch in the queue-delivery fixture

Christian Brauner <[email protected]> Fri, 31 Jul 2026 11:21:22 +0200
Newsgroups org.kernel.linux.tools
Message-ID <20260731-work-b4-editor-branch-guard-v1-23-de68a7c8e4cb@kernel.org>
test_commit_reachable_unknown_tips clones a bare repository that it
seeded by pushing to refs/heads/master, but it created that repository
with a plain "git init --bare". The clone takes its HEAD from the
remote, so with an init.defaultBranch of anything other than "master" it
ends up on an unborn branch. The commit meant to advance the remote
becomes an unrelated root commit and the push after it is rejected as a
non-fast-forward.

The test then fails on a setup assertion and never gets to what it is
about. Name the initial branch so the fixture builds the repository it
means to build no matter what the developer has configured.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 src/tests/test_ty.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/tests/test_ty.py b/src/tests/test_ty.py
index ddf3d7e..5b08587 100644
--- a/src/tests/test_ty.py
+++ b/src/tests/test_ty.py
@@ -316,7 +316,10 @@ def test_commit_reachable_unknown_tips(
     pub = str(tmp_path / 'pub')
     other = str(tmp_path / 'other')
     _init_repo(local)
-    ecode, out = b4.git_run_command(None, ['init', '--bare', pub])
+    # -b master: the clone below takes its HEAD from this repository, and an
+    # init.defaultBranch of 'main' would leave it on an unborn branch, with
+    # the "advance the remote" commit landing as an unrelated root commit.
+    ecode, out = b4.git_run_command(None, ['init', '--bare', '-b', 'master', pub])
     assert ecode == 0, out
     monkeypatch.chdir(local)
     c1 = _commit_empty('c1')

-- 
2.53.0