revive but worktree subcommands#14213
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Revives the legacy but worktree CLI flow by reintroducing end-to-end CLI tests and modernizing the but-worktrees crate APIs so worktree creation/list/destroy/integration can be driven from the current workspace/graph plumbing (instead of Context-centric legacy APIs).
Changes:
- Added legacy CLI integration tests for
but worktree new/list/integrate/destroy, including the “nothing to integrate” case. - Refactored
but-worktreesto accept narrow inputs (gix::Repository,but_graph::Workspace,data_dir) and switched worktree creation togit worktree add --detach(avoiding hidden branches). - Reimplemented integration using the graph rebase editor/materialization path and added new/updated tests to cover conflict and safety behaviors (including aborting when main worktree has uncommitted changes).
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/but/tests/but/command/worktree.rs | New legacy CLI tests covering the full worktree journey and destroy modes |
| crates/but/tests/but/command/mod.rs | Registers the new worktree test module behind legacy |
| crates/but/src/lib.rs | Adjusts legacy worktree subcommand error propagation |
| crates/but/src/command/legacy/worktree.rs | Adds CLI output for NothingToIntegrate dry-run status |
| crates/but-worktrees/tests/worktree/worktree_new.rs | Simplifies/modernizes worktree-new tests via shared helpers |
| crates/but-worktrees/tests/worktree/worktree_destroy.rs | Updates destroy tests to new narrow APIs/helpers |
| crates/but-worktrees/tests/worktree/various.rs | Updates/expands integration behavior tests (including abort-on-uncommitted-changes) |
| crates/but-worktrees/tests/worktree/main.rs | Introduces helper wrappers to derive narrow inputs from Context for tests |
| crates/but-worktrees/src/new.rs | Changes worktree_new signature; creates detached worktrees under data_dir |
| crates/but-worktrees/src/list.rs | Changes worktree_list signature to take &gix::Repository |
| crates/but-worktrees/src/lib.rs | Updates serde behavior for WorktreeId and worktree JSON fields |
| crates/but-worktrees/src/integrate.rs | Adds NothingToIntegrate; rewrites integration to graph-editor + materialize |
| crates/but-worktrees/src/git.rs | Updates git worktree add/remove invocation and error/log handling |
| crates/but-worktrees/src/destroy.rs | Changes destroy APIs to take &gix::Repository and uses new list API |
| crates/but-worktrees/Cargo.toml | Drops legacy deps, adds but-graph + but-serde, moves but-ctx to dev-deps |
| crates/but-serde/src/lib.rs | Adds bstring_lossy::deserialize support |
| crates/but-api/src/legacy/worktree.rs | Adapts legacy API layer to the new but-worktrees signatures |
| Cargo.lock | Locks updated dependency graph |
7beaca5 to
9547b84
Compare
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.
@estib-vega @Caleb-T-Owens - the subtree stuff should "work" now. it's still a hidden subcommand until we figure stuff out