Skip to content

Fix rename_worktree refusing every freshly created worktree - #293

Merged
frenchie4111 merged 1 commit into
mainfrom
s-bug-new-kickoff-prompt
Aug 22, 2026
Merged

Fix rename_worktree refusing every freshly created worktree#293
frenchie4111 merged 1 commit into
mainfrom
s-bug-new-kickoff-prompt

Conversation

@frenchie4111

Copy link
Copy Markdown
Collaborator

Summary

  • renameWorktreeBranch refused the rename whenever @{upstream} was set. Git's default branch.autoSetupMerge points a branch cut from origin/main at origin/main, so every worktree Ness creates looked already-published — the kickoff-prompt rename flow failed 100% of the time with branch "..." is already published (tracking origin/main).
  • The guard now looks for a remote ref named after the branch itself (refs/remotes/*/<branch>), falling back to the upstream only when the upstream names that same branch. That also closes a hole in the old check: a plain git push origin <branch> updates the remote-tracking ref without setting an upstream, and used to sail straight through.
  • Added src/main/worktree-rename.integration.test.ts — real git, no mocks.

Test plan

  • npx vitest run src/main/worktree-rename.integration.test.ts — renames succeed for a fresh branch tracking origin/main and for a slash-containing name; still refused after push -u, after a plain push, and for a published slashed branch; target-name collision still reports the existing branch.
  • npm run typecheck
  • npx electron-vite build
  • npx vitest run — remaining failures (git-ops-state, path-fix, worktree-watcher) are pre-existing timeouts under parallel load and pass in isolation.
  • Verified the new for-each-ref glob against this repo: the unpushed branch matches nothing, main matches all seven remotes' refs.

Note: a running Ness carries the old main-process code, so the tool keeps refusing until the app restarts on this build.

🤖 Generated with Claude Code

The published-branch guard treated any configured upstream as proof the
branch had been pushed. Git's default branch.autoSetupMerge points a
branch cut from origin/main at origin/main, so every new worktree looked
published and the kickoff-prompt rename flow failed 100% of the time.

Check for a remote ref named after the branch itself instead, which also
catches a plain `git push origin <branch>` that never set an upstream.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@frenchie4111
frenchie4111 force-pushed the s-bug-new-kickoff-prompt branch from 4033b30 to 1c0bda4 Compare August 22, 2026 00:24
@frenchie4111
frenchie4111 merged commit 424036e into main Aug 22, 2026
1 check passed
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