test: pin the branch in the t900 tests that push to main - #199
Merged
Merged
Conversation
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #193, #194, #195.
Three tests create their repositories with a bare
git initand then namemain, so they fail whereverinit.defaultBranchis unset and git still defaults tomaster(git 2.43 here).t9001-subdir-pushgit push origin main(×3, plus one knock-on)t9004-workspace-routinggrep "main" branch.outt9005-workspace-commit-pushgit push origin mainThe fix
For
t9001andt9005the branch to pin is the bare upstream's, not the clone's — the working clone adopts the remote's unborn HEAD, so one change fixes the push without touching the clone:t9004creates its repository directly, so it is pinned in place.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.Verification
All three pass in full with
init.defaultBranchunset, and with it set tomain— so the fix removes the dependency rather than moving it:The whole
test-subdirtask afterwards:The one remaining failure is
t9007-workspace-nested-translation.sh, left alone deliberately — see #196. It expectsbit repo statusfrom a deep nested path to fail withNot a git repositoryand it does not, while the sibling assertion at the workspace root passes. Deciding whether the test's expectation or the behaviour is right is a call for a maintainer, not a mechanical fix.A correction worth flagging
While preparing this I found that four of the six issues I filed after #192 were wrong, and I have corrected them: #197 and #198 are closed as not-a-bug, and #194, #195, #196 had retractions added.
I had reported that implicit command translation was broken —
bit statusinside a workspace returning plain git status instead of the workspace form. It is not. The container I triaged in exports git config through the environment (GIT_CONFIG_COUNT,GIT_CONFIG_KEY_0..2,GIT_CONFIG_VALUE_0..2, holdingcredential.interactiveand twourl.*.insteadOfentries for its proxy).should_delegate_to_real_git(modules/bit/cmd/bit/main.mbt:1044) treats any such injection as a reason to hand the command to the real git binary, and it runs beforeworkspace_translate_implicit_command— which is the documented intent of that check. With those variables unset, every one of those assertions passes.Every measurement in this PR was taken with
GIT_CONFIG_*unset.🤖 Generated with Claude Code
https://claude.ai/code/session_01VDVUJHu38YtVAr6sKZtRDB
Generated by Claude Code