Skip to content

feat(worktrees): configurable base branch + local/remote picker - #752

Merged
im-ian merged 1 commit into
mainfrom
feat/project-worktree-base-branch
Aug 5, 2026
Merged

feat(worktrees): configurable base branch + local/remote picker#752
im-ian merged 1 commit into
mainfrom
feat/project-worktree-base-branch

Conversation

@im-ian

@im-ian im-ian commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

Project worktrees can now start from a branch selected per project while preserving Acorn's existing automatic default behavior.

  1. Project setting — Added a searchable worktree base-branch selector with Automatic, detected local branches, detected remote-tracking branches, and direct branch-name input.
  2. Repository-backed choices — Added a backend branch-list command that reads the local repository's live refs and omits symbolic remote HEAD entries.
  3. Creation behavior — Applied the configured branch to isolated sessions, prepared chat worktrees, and IPC-created sessions, with save-time validation for stale or missing refs.
  4. Compatibility and coverage — Kept existing settings files backward-compatible, retained the main/master/HEAD fallback when Automatic is selected, and covered persistence, resolution, listing, and UI flows.

Expected impact

Area Before After
New Acorn worktrees Always used the automatic main/master/HEAD fallback Use the project's configured base branch, or the same fallback when Automatic is selected
Project settings UX No worktree base-branch control Searchable local/remote selector plus custom input
Invalid configured refs Could not be configured Rejected while saving before they can affect worktree creation

Design notes

  • Detected selections are persisted as full refs (refs/heads/... or refs/remotes/...) so identically named local and remote branches remain unambiguous.
  • Custom shorthand remains supported and resolves local branches first, then named remote-tracking refs, then origin/<name>.
  • Branch discovery reads refs already present in the repository and does not perform a network fetch.
  • Automatic remains represented by a null setting, preserving existing project-settings serialization and worktree fallback behavior.

Test plan

  • pnpm run typecheck
  • pnpm run test — 109 files, 1,289 tests passed
  • pnpm exec playwright test tests/e2e/project-settings.spec.ts — 9 tests passed
  • pnpm run build
  • cargo test --manifest-path src-tauri/Cargo.toml project_settings::tests --lib — 5 tests passed
  • cargo test --manifest-path src-tauri/Cargo.toml worktree::tests --lib — 28 tests passed
  • cargo check --manifest-path src-tauri/Cargo.toml
  • Targeted rustfmt --check for the modified Rust modules
  • git diff --check

Notes

  • Full-repository cargo fmt --check still reports the pre-existing formatting difference in src-tauri/src/pty_env.rs; this PR does not modify that file.
  • cargo check reports five pre-existing dead-code warnings.

@im-ian im-ian added the feat New feature label Aug 5, 2026
@im-ian
im-ian merged commit 2cff145 into main Aug 5, 2026
3 checks passed
@im-ian
im-ian deleted the feat/project-worktree-base-branch branch August 5, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant