Skip to content

tests: pin the worktree fixture branch name across git builds - #17

Open
gjjkbssg wants to merge 1 commit into
clawkwork:mainfrom
gjjkbssg:fix/worktree-test-default-branch
Open

tests: pin the worktree fixture branch name across git builds#17
gjjkbssg wants to merge 1 commit into
clawkwork:mainfrom
gjjkbssg:fix/worktree-test-default-branch

Conversation

@gjjkbssg

Copy link
Copy Markdown

Fixes #16

internal/worktree's helper inits its fixture repo with the git build's default branch name and then hardcodes checkout master. Apple Git inits on "main" (and the helper masks the global config, so the built-in default is what applies), so make test fails on every macOS developer machine while staying green on the Linux CI runners whose git still defaults to "master" — awkward for a project whose primary platform is macOS.

The change pins the name at init (git init -b main, git >= 2.28) and checks out main in TestRemoveAll and the fixture helper, which also matches the helper's existing "Initial commit on main" comment. No production code touched.

Verified on macOS 15 (Apple Git 2.39.3, arm64): gofmt -l clean, go vet and go test ./... green in both the root and machine/ modules.

Apple Git initializes new repositories on "main" while stock Linux git
still defaults to "master"; the hardcoded checkouts therefore fail on
macOS developer machines even though the suite is green on the Linux CI.
init -b main pins the name explicitly and the checkouts match it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worktree tests fail on git builds that init on main

1 participant