Skip to content

🐛 fix: ✅ workset tests fail on WSL because git 2.43 never creates origin/HEAD - #86

Merged
hadees merged 2 commits into
mainfrom
fix/workset-fixture-origin-head
Sep 24, 2026
Merged

hadees merged 2 commits into
mainfrom
fix/workset-fixture-origin-head

Conversation

@hadees

@hadees hadees commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Why

test-wsl has failed on every push to main since #76, always on the same two tests: tests/workset.bats "checkout: creates worktrees on origin/HEAD…" (fatal: ambiguous argument 'origin/HEAD') and "close: … deletes the branch". The fixtures built their origin with init --bare + remote add + push + fetch. That sequence creates refs/remotes/origin/HEAD only on git ≥ 2.48 (remote.<name>.followRemoteHEAD). The WSL job's Ubuntu 24.04 ships 2.43, so the ref never exists there. The script itself behaves correctly on that git; the fixture was wrong.

What

  • A shared mk_origin helper replaces the two duplicated origin blocks. It ends with a local git remote set-head origin main.
  • A new test covers the no-origin/HEAD fallback: the worktree is based on HEAD, and close keeps a branch it can't prove merged. Its assertions use the ! cmd || { …; false; } form, because a bare ! mid-test never fails a bats test.

Verification

  • Reproduced locally on git 2.55 with GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=remote.origin.followRemoteHEAD GIT_CONFIG_VALUE_0=never bats tests/workset.bats. Before the fix, exactly the two CI tests fail, with the same error. After the fix, 22/22 pass, and 22/22 pass plainly too.
  • Mutation checks: removing the set-head --delete line, or the never pin, turns the new test red with its own message.
  • bats tests: 555/555.

Unblocks #85, which needs main merged in after this lands. A re-run reuses the old SHA.

🤖 Generated with Claude Code

hadees and others added 2 commits September 24, 2026 14:07
The checkout and close tests built their origin with init + remote add +
push + fetch, which only creates refs/remotes/origin/HEAD on git >= 2.48.
CI's WSL job runs Ubuntu 24.04's git 2.43, so both tests have failed there
on every push since the workset PR. A shared mk_origin helper now ends with
a local `git remote set-head origin main`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ises it

With the fixtures now setting origin/HEAD, the fallback that git < 2.48
takes (base the worktree on HEAD, keep a branch close cannot prove merged)
was covered nowhere. The new test deletes origin/HEAD, pins
remote.origin.followRemoteHEAD=never so a fetch on newer git cannot bring
it back, and asserts both with the `! cmd || { ...; false; }` form: a bare
`!` mid-test never trips errexit, so bats would pass it regardless.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hadees hadees self-assigned this Sep 24, 2026
@hadees
hadees merged commit 3d02a7c into main Sep 24, 2026
5 checks passed
@hadees
hadees deleted the fix/workset-fixture-origin-head branch September 24, 2026 21:05
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.

1 participant