Skip to content

slop worktrees experiment... don't review... or look at... - #14789

Draft
Caleb-T-Owens wants to merge 20 commits into
masterfrom
claude/worktree-implementation-c6db3f
Draft

slop worktrees experiment... don't review... or look at...#14789
Caleb-T-Owens wants to merge 20 commits into
masterfrom
claude/worktree-implementation-c6db3f

Conversation

@Caleb-T-Owens

@Caleb-T-Owens Caleb-T-Owens commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

The commits say "Caleb and claude"... that is a lie. It's all claude...

@github-actions github-actions Bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Jul 15, 2026
Caleb-T-Owens and others added 8 commits July 15, 2026 21:09
- FeatureFlags.worktree_manipulation (settings.json-only, like tui_file_browser)
- worktree_meta DB table keyed by git worktree name (BLOB, stable across
  'git worktree move' unlike paths) with an archived flag
- regenerated SDK types

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- init::Options.worktree_tips: caller-resolved (ref, fallback id) pairs,
  re-resolved through the ref-store overlay on every (re)traversal, appended
  after all other initial work and deduped by commit id
- but-ctx: Context::active_worktrees() enumerates linked worktrees, reconciles
  the worktree_meta table (first-ever read archives pre-existing worktrees),
  and workspace_from_head seeds the graph when worktreeManipulation is on

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Checkout::Worktree entries are recorded at editor creation for every branch
checked out in a worktree named by the graph's worktree_tips - so the gating
and archived-filtering decided at graph-seeding time (worktreeManipulation
flag) carries over to checkouts with no per-call-site threading.

Worktree checkouts run before the Head checkout, never allow conflicted
trees into plain worktrees, and degrade to a warning (stale checkout,
today's behavior) when a worktree is broken. WorktreeTip gained the
worktree name to carry the allowlist on the graph.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Editor::create records every ref carrying a not-owned-by-repo worktree
annotation (independent of the feature flag), and the rebase ref-deletion
pass skips them - mirroring git's own refusal to delete a checked-out
branch. This centrally covers upstream integration's integrated-ref
cleanup and its review-hints Step::None path, plus every other editor op.

Also: clarify worktree-tip ref-resolution docs and make the detached-HEAD
fallback explicit in append_worktree_tips (review findings).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
but-workspace::worktrees: list_worktrees splits active (slim WorktreeStack
with first-parent commits vs target via local_commits_for_branch) from
archived (minimal DTO); set_worktree_archived; worktree_changes_by_name.
but-api::worktrees (CLI-only): worktrees_list, worktree_set_archived,
linked_worktree_changes - all gated on the worktreeManipulation flag.

Review fixes in but-ctx reconciliation:
- adopt ALL on-disk worktrees at first read, not just the usable subset
- an adoption sentinel row persists the marker for zero-worktree projects
- deleted checkout dirs (prunable) are reconciled but never active
- zero-worktree repos skip the cwd-dependent realpath machinery
- flag-off no-side-effects and flag-on seeding are now tested

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- CliId::Worktree minted after all existing allocations (id stability),
  in both IdMap construction paths, sorted by name; parseable by chip or
  worktree name; explicit eq/same-entity arms (wildcard sites the
  compiler can't force)
- status renders active worktrees as branch-style groups after stacks
  with the path relativized to the main workdir; JSON gains a worktrees
  field (absent when the flag is off - byte-identical output)
- but worktree archive|unarchive <id|name>, resolved via IdMap, calling
  the new but-api; legacy worktree subcommands untouched
- flag-off regression gate: all 493 CLI integration tests unchanged

Also fix a clippy filter_map_bool_then deny from the Stage 4 commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
but worktree amend <name> <commit> [--changes paths]: reads DiffSpecs from
the worktree's own repository (objects land in the shared ODB, so the
editor's in-memory repo sees them), amends via the factored commit_amend
engine, and keys the resulting merge-base override to that worktree's
Checkout::Worktree so the consumed hunk cancels out of its checkout
instead of duplicating.

When the worktree's tip doesn't move (target lives elsewhere), a
post-materialize discard_workspace_changes on the worktree removes the
now-committed hunk - only after commit and refs are durable, gated on
tip-unchanged, with unmatched specs warn-logged rather than clobbered.

Worktree branches are made mutable via extra_mutable_refs from the
graph's worktree tips; without this the branch ref would silently never
move. Oplog snapshotting deferred (documented on the command).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- worktree matches no longer make priority-less or branch-name resolution
  ambiguous when a worktree shares its branch's name (the canonical state):
  try_resolve_cli_id and push/land/unapply/squash drop worktree matches
  when anything else matched; a sole worktree match keeps its kind error
- worktree chips are derived from the worktree name (like branch short
  ids) and names are reserved in the allocator - chips no longer shift
  with the uncommitted-file set (silent wrong-target archive) and a
  worktree named like a chip can't shadow allocated ids
- same_entity_for_reload got its Worktree arm: TUI cursor survives
  reloads and jump-to-worktree works on worktree rows
- the per-worktree commit walk is capped at 25 and decode failures
  truncate that worktree's list with a warning instead of failing status

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Caleb-T-Owens
Caleb-T-Owens force-pushed the claude/worktree-implementation-c6db3f branch from 4b604f6 to 52444ef Compare July 15, 2026 19:09
- amending into an immutable commit fails fast instead of silently
  no-opping - previously the worktree discard fallback then DELETED the
  changes it believed were committed (data loss)
- the whole-file discard fallback content-verifies each file against its
  pre-amend hash and leaves mid-operation edits in place (warn + skip),
  making the never-loss invariant hold for whole-file specs
- amends whose rebase would leave a worktree tip conflict-encoded are
  refused before materializing (plain git worktrees have no conflict UI)
- materialize_without_checkout now runs worktree checkouts too - its
  contract only exempts the editor's own worktree
- but worktree amend resolves worktree-only commits via rev-parse
- worktree chips never collide with change-id chips and the no-window
  fallback is a deterministic name-seeded probe (no more migration when
  the uncommitted-file set changes)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Caleb-T-Owens
Caleb-T-Owens force-pushed the claude/worktree-implementation-c6db3f branch from 52444ef to b00bdb6 Compare July 15, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant