From 0b2ce7413dccadbdeb26dda94403e8250c9c483e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 01:38:29 +0000 Subject: [PATCH] test: pin the branch in the t900 tests that push to main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three tests create their repositories with a bare `git init` and then name `main`, so they fail wherever init.defaultBranch is unset and git still defaults to `master` (git 2.43 here): t9001-subdir-push 19 of 23 passed `git push origin main` t9004-workspace-routing 7 of 8 passed `grep "main" branch.out` t9005-workspace-commit-push 6 of 7 passed `git push origin main` For t9001 and t9005 the branch to pin is the bare upstream's: the working clone adopts the remote's unborn HEAD, so setting it there fixes the push without touching the clone. t9004 creates its repository directly. Setting HEAD while it is unborn rather than passing `git init -b`, which needs git 2.28 — the same form used for the fixture in #192. All three now pass in full, both with init.defaultBranch unset and with it set to main, so the fix does not just move the dependency. Fixes #193 Fixes #194 Fixes #195 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB --- t/t9001-subdir-push.sh | 4 +++- t/t9004-workspace-routing.sh | 1 + t/t9005-workspace-commit-push.sh | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/t/t9001-subdir-push.sh b/t/t9001-subdir-push.sh index 9fc4b855..aeb60893 100755 --- a/t/t9001-subdir-push.sh +++ b/t/t9001-subdir-push.sh @@ -11,7 +11,9 @@ TEST_DIRECTORY=$(cd "$(dirname "$0")" && pwd) # Setup: create upstream repository test_expect_success 'setup: create upstream repository' ' mkdir -p upstream && - (cd upstream && git init --bare) + (cd upstream && + git init --bare && + git symbolic-ref HEAD refs/heads/main) ' test_expect_success 'setup: create working clone' ' diff --git a/t/t9004-workspace-routing.sh b/t/t9004-workspace-routing.sh index ad2e16f3..8d3c2c74 100755 --- a/t/t9004-workspace-routing.sh +++ b/t/t9004-workspace-routing.sh @@ -12,6 +12,7 @@ test_expect_success 'setup: create repository with initial commit' ' mkdir repo && (cd repo && git init && + git symbolic-ref HEAD refs/heads/main && git config user.email "test@example.com" && git config user.name "Test User" && echo "hello" > README.md && diff --git a/t/t9005-workspace-commit-push.sh b/t/t9005-workspace-commit-push.sh index 3cb0ec2e..9e358b77 100755 --- a/t/t9005-workspace-commit-push.sh +++ b/t/t9005-workspace-commit-push.sh @@ -10,7 +10,9 @@ TEST_DIRECTORY=$(cd "$(dirname "$0")" && pwd) test_expect_success 'setup: create upstream bare repository and working clone' ' mkdir upstream.git && - (cd upstream.git && git init --bare) && + (cd upstream.git && + git init --bare && + git symbolic-ref HEAD refs/heads/main) && git clone upstream.git work && (cd work && git config user.email "test@example.com" &&