Skip to content

Worktree tests fail on git builds that init on main #16

Description

@gjjkbssg

On a macOS developer machine with Apple Git (git 2.39+), make test fails in internal/worktree:

Test: TestRemoveAll
Messages: git -C ... checkout master failed: error: pathspec 'master' did not match any file(s) known to git

The suite is green on the Linux CI because the runner's git still initializes new repositories on "master", while Apple Git initializes "main" (the test helper already masks the global config with GIT_CONFIG_GLOBAL=/dev/null, so the built-in default is what leaks through). The tests hardcode checkout master even though the helper's own comment says the initial commit lands on main — clawk's primary platform is macOS, so every Mac dev hits this before their first contribution.

Fix is to pin the name at init (git init -b main) and check out main in both tests; then the suite is independent of the git build's default. I have the change ready and will open a PR referencing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions