Repository navigation
🐛 fix: ✅ workset tests fail on WSL because git 2.43 never creates origin/HEAD - #86
Merged
Merged
Conversation
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>
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.
Why
test-wslhas 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 withinit --bare+remote add+push+fetch. That sequence createsrefs/remotes/origin/HEADonly 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
mk_originhelper replaces the two duplicated origin blocks. It ends with a localgit remote set-head origin main.closekeeps 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
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.set-head --deleteline, or theneverpin, 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