Repository navigation
feat(config): add [remove] delete-branch config option - #2589
Conversation
Adds a new [remove] config section with a delete-branch boolean, mirroring the existing [merge] pattern. Setting delete-branch = false is equivalent to passing --no-delete-branch on every wt remove invocation. CLI flags (--delete-branch / --no-delete-branch) override the config, and project overrides are supported via [projects."<id>".remove]. Closes #2587. Co-Authored-By: Claude Opus 4.7 <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
Self-authored review — flagging one concrete issue and one phrasing note. Not approving (GitHub blocks self-approval).
The two new integration tests bypass the repo.wt_command() helper and only set WORKTRUNK_CONFIG_PATH / WORKTRUNK_APPROVALS_PATH manually. repo.wt_command() additionally sets HOME, WORKTRUNK_SYSTEM_CONFIG_PATH, mock command paths, and the git config isolation env — tests/CLAUDE.md calls this out as required to prevent host-environment leakage. Inline suggestions below switch them over.
The conflict error in src/main.rs:884 still hard-codes the CLI flag name (Cannot use --force-delete with --no-delete-branch). Now that delete_branch=false can come from [remove] delete-branch = false in config, a user who only types wt remove --force-delete and has never seen --no-delete-branch will get a confusing message. Worth softening, e.g. Cannot use --force-delete with delete-branch=false or expanding to mention either source.
- Switch new integration tests to repo.wt_command() so they pick up HOME, WORKTRUNK_SYSTEM_CONFIG_PATH, mock command paths, and git config isolation (per tests/CLAUDE.md). - Soften the conflict error to mention either source of delete-branch=false, since it can now come from config rather than only --no-delete-branch. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Softened the conflict error in 060d3b9:
Snapshot regenerated. |
## Summary Release v0.48.0. See [CHANGELOG.md](https://github.com/max-sixty/worktrunk/blob/release/CHANGELOG.md) for the full notes. Highlights: - `--format=json` extends to seven step + hook commands (#2560) - `wt step commit` / `wt step squash` gain `--dry-run` (#2557) - New `dirname` / `basename` template filters (#2592, #2605) - New `[remove] delete-branch` config option (#2589) - `wt-perf timeline` subcommand (#2558) - Faster `wt list` on dirty worktrees (#2602) and faster alias dispatch (#2556, #2573) - Short-SHA display honors `core.abbrev` (#2576) - Cleaner `wt config show` shell-integration section for new users ## Test plan - [x] `cargo run -- hook pre-merge --yes` (3497 tests, lints clean) - [x] `cargo semver-checks check-release -p worktrunk` consulted; minor bump confirmed - [ ] CI green
Summary
Adds a
[remove]config section that lets users defaultwt removeto keeping branches, requested in #2587. Settingdelete-branch = falseis equivalent to passing--no-delete-branchevery time; CLI flags still override the config.Implementation mirrors the existing
[merge]pattern: newRemoveConfigsection, a[projects."<id>".remove]override path, and a tri-state CLI flag pair (--delete-branch/--no-delete-branch) so users can override config either direction.Test plan
RemoveConfigparse/default/merge + project override (src/config/user/tests.rs)[remove] delete-branch = falsekeeps the branch onwt remove--delete-branchoverrides the configwt removetests still pass (83 tests)cargo test --lib --binsandcargo clippy --tests --all-featurescleantest_docs_are_in_sync)Closes #2587.