Loading…
Reference in a new issue
No description provided.
Delete branch "1908"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes swamp-club #1908 and #1892.
What
ensure_worktree— idempotently prepares one worktree and branch per work item:refs/heads/<x>,refs/tags/<x>, or a bare name meaningrefs/heads/<name>— never a suffix match) into a private temp ref with--no-write-fetch-head --refmap= --no-tags, so concurrent calls against one repository never contend onFETCH_HEADor the remote-tracking ref;root, the primary checkout, the git directory, anything overlapping another worktree, a branch checked out elsewhere, unrelated history, detached HEADs, and in-progress rebase/merge/cherry-pick/revert;baseCommitis the merge-base of HEAD and the fetched base (stable across rework after the base moves);expectedBaseCommitfails closed before anything is created;requireCleanPrimaryignores registered worktrees nested in the primary.verify_worktree— read-only (--no-optional-locks, no fetch, no ref writes) fail-closed check against branch, base lineage, root, git-dir linkage, and remote URL, reporting every mismatch at once.remove_worktreefix — compares symlink-resolved paths, so a path through a symlink (macOS/tmp) is removed instead of reported already absent.2026.09.28.1with upgrade entry.Testing
255 tests pass, including real-git tests against a local bare origin (no network): every create/reuse/attach/refusal path, base-ref forms, relative and symlinked paths, paths with spaces, an 8-way concurrency test, verify_worktree read-only and multi-mismatch checks, and the remove_worktree symlink regression. The concurrency design was checked against real git first: without
--refmap=, 11 of 12 parallel fetches failed on the remote-tracking ref lock; with it, 0 of 48.Verification: verify-build and verify-reviews pass on the head commit; attestation posted.
Known limitations
baseneeds the server to allow fetching it (GitHub and Forgejo allow reachable SHAs; some self-hosted servers don't). It fails with git's error.ensure_checkoutdoes, sowi/1andwi-1share a data name.🤖 Generated with Claude Code