Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Improve visibility of branch deletion status in wt remove output (#298)

Maximilian Roos3e377b280340
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 000000000..a3d5d986c
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,12 @@
+coverage:
+ status:
+ project:
+ default:
+ target: auto
+ threshold: 1%
+ patch:
+ default:
+ # Lower patch coverage target to account for:
+ # - LLVM coverage instrumentation quirks with multiline macros
+ # - Error handling paths that are difficult to test
+ target: 85%
diff --git a/src/commands/repository_ext.rs b/src/commands/repository_ext.rs
index bb2c26061..d857e577f 100644
--- a/src/commands/repository_ext.rs
+++ b/src/commands/repository_ext.rs
@@ -332,17 +332,22 @@ fn load_project_config_at(repo_root: &Path) -> anyhow::Result<Option<ProjectConf
/// Compute integration reason for branch deletion.
///
/// Returns `None` if:
-/// - `deletion_mode` is `Keep` or `ForceDelete` (skip integration check)
+/// - `deletion_mode` is `ForceDelete` (skip integration check)
/// - `branch_name` is `None` (detached HEAD)
/// - `target_branch` is `None` (no target to check against)
/// - Branch is not integrated into target (safe deletion not confirmed)
+///
+/// Note: Integration is computed even for `Keep` mode so we can inform the user
+/// if the flag had an effect (branch was integrated) or not (branch was unmerged).
fn compute_integration_reason(
main_path: &Path,
branch_name: Option<&str>,
target_branch: Option<&str>,
deletion_mode: BranchDeletionMode,
) -> Option<IntegrationReason> {
- if deletion_mode.should_keep() || deletion_mode.is_force() {
+ // Skip for force delete (we'll delete regardless of integration status)
+ // But compute for keep mode so we can inform user if the flag had no effect
+ if deletion_mode.is_force() {
return None;
}
let (branch, target) = branch_name.zip(target_branch)?;
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 8f0f4e7b1..941c930b2 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -285,54 +285,6 @@ fn get_flag_note(
}
}
-/// Format message for remove worktree operation (includes emoji and color for consistency)
-///
-/// Returns a FormattedMessage with green styling for success messages.
-/// The symbol (if present) is placed outside the green so it renders in its canonical dim styling.
-///
-/// `target_branch`: The branch we checked integration against (Some = merge context, None = explicit remove)
-fn format_remove_worktree_message(
- branch_name: &str,
- branch: Option<&str>,
- deletion_mode: BranchDeletionMode,
- outcome: &BranchDeletionOutcome,
- target_branch: Option<&str>,
-) -> FormattedMessage {
- let flag_note = get_flag_note(deletion_mode, outcome, target_branch);
-
- let branch_display = branch.or(Some(branch_name));
-
- // Build message parallel to background format: "Removed {branch} worktree & branch{flag_note}"
- let branch_deleted = matches!(
- outcome,
- BranchDeletionOutcome::ForceDeleted | BranchDeletionOutcome::Integrated(_)
- );
-
- // Determine action suffix based on what happened to the branch
- let action_suffix = if branch_deleted {
- "worktree & branch"
- } else if deletion_mode.should_keep() {
- // User explicitly kept the branch via --no-delete-branch
- "worktree"
- } else if matches!(outcome, BranchDeletionOutcome::NotDeleted) {
- // Branch retained because it has unmerged changes
- "worktree; retaining unmerged branch"
- } else {
- "worktree"
- };
-
- // Symbol must be inside the <green> block to get proper coloring.
- // flag_after contains integration symbols (like _) that render outside green in dim.
- let flag_text = &flag_note.text;
- let flag_after = flag_note.after_green();
- let msg = if let Some(b) = branch_display {
- cformat!("<green>✓ Removed <bold>{b}</> {action_suffix}{flag_text}</>{flag_after}")
- } else {
- cformat!("<green>✓ Removed {action_suffix}{flag_text}</>{flag_after}")
- };
- FormattedMessage::new(msg)
-}
-
/// Shell integration hint message
fn shell_integration_hint() -> String {
cformat!("Run <bright-black>wt config shell install</> to enable automatic cd")
@@ -680,27 +632,42 @@ fn handle_removed_worktree_output(
// Reason in parentheses: user flags shown explicitly, integration reason for automatic cleanup
// Note: We use FormattedMessage directly instead of progress_message() to control
// where cyan styling ends. Symbol must be inside the <cyan> block to get proper coloring.
- let action = if deletion_mode.should_keep() {
- cformat!(
- "<cyan>◎ Removing <bold>{branch_name}</> worktree in background; retaining branch{flag_text}</>{flag_after}"
- )
- } else if should_delete_branch {
+ //
+ // Message structure by case:
+ // - Branch deleted (integrated/force): "worktree & branch in background (reason)"
+ // - Branch kept (any reason): "worktree in background" + hint (if relevant)
+ let branch_was_integrated = pre_computed_integration.is_some();
+
+ let action = if should_delete_branch {
+ // Branch will be deleted (integrated or force-deleted)
cformat!(
"<cyan>◎ Removing <bold>{branch_name}</> worktree & branch in background{flag_text}</>{flag_after}"
)
} else {
- cformat!(
- "<cyan>◎ Removing <bold>{branch_name}</> worktree in background; retaining unmerged branch</>"
- )
+ // Branch kept: hint will explain why (integrated+flag, unmerged, or unmerged+flag)
+ cformat!("<cyan>◎ Removing <bold>{branch_name}</> worktree in background</>")
};
super::print(FormattedMessage::new(action))?;
- // Show hint for unmerged branches (same as synchronous path)
- if !deletion_mode.should_keep() && !should_delete_branch {
- let cmd = suggest_command("remove", &[branch_name], &["-D"]);
- super::print(hint_message(cformat!(
- "To delete the unmerged branch, run <bright-black>{cmd}</>"
- )))?;
+ // Show hints for branch status
+ if !should_delete_branch {
+ if deletion_mode.should_keep() && branch_was_integrated {
+ // User kept an integrated branch - show integration info
+ let reason = pre_computed_integration.as_ref().unwrap();
+ let target = effective_target.as_deref().unwrap_or("target");
+ let desc = reason.description();
+ let symbol = reason.symbol();
+ super::print(hint_message(cformat!(
+ "Branch integrated ({desc} <bold>{target}</>, <dim>{symbol}</>); retained with <bright-black>--no-delete-branch</>"
+ )))?;
+ } else if !deletion_mode.should_keep() {
+ // Unmerged, no flag - show how to force delete
+ let cmd = suggest_command("remove", &[branch_name], &["-D"]);
+ super::print(hint_message(cformat!(
+ "Branch unmerged; to delete, run <bright-black>{cmd}</>"
+ )))?;
+ }
+ // else: Unmerged + flag - no hint (flag had no effect)
}
print_switch_message_if_changed(changed_directory, main_path)?;
@@ -741,7 +708,9 @@ fn handle_removed_worktree_output(
// Delete the branch (unless --no-delete-branch was specified)
// Only show effective_target in message if we had a meaningful target (not tautological "HEAD" fallback)
- let (outcome, effective_target, show_hint) = if !deletion_mode.should_keep() {
+ let branch_was_integrated = pre_computed_integration.is_some();
+
+ let (outcome, effective_target, show_unmerged_hint) = if !deletion_mode.should_keep() {
let deletion_repo = worktrunk::git::Repository::at(main_path);
let check_target = target_branch.unwrap_or("HEAD");
let result = delete_branch_if_safe(
@@ -762,21 +731,49 @@ fn handle_removed_worktree_output(
)
};
- // Show success message (includes emoji and color)
- super::print(format_remove_worktree_message(
- branch_name,
- branch,
- deletion_mode,
- &outcome,
- effective_target.as_deref(),
- ))?;
-
- // Show hint for unmerged branches (after success message)
- if show_hint {
- let cmd = suggest_command("remove", &[branch_name], &["-D"]);
- super::print(hint_message(cformat!(
- "To delete the unmerged branch, run <bright-black>{cmd}</>"
- )))?;
+ let branch_deleted = matches!(
+ outcome,
+ BranchDeletionOutcome::ForceDeleted | BranchDeletionOutcome::Integrated(_)
+ );
+ // Use branch if provided, otherwise fall back to branch_name (which is always
+ // Some here since we returned early for detached HEAD case on line 565)
+ let branch_display = branch.unwrap_or(branch_name);
+
+ // Message structure parallel to background mode:
+ // - Branch deleted (integrated/force): "worktree & branch (reason)"
+ // - Branch kept (any reason): "worktree" + hint (if relevant)
+ let msg = if branch_deleted {
+ let flag_note = get_flag_note(deletion_mode, &outcome, effective_target.as_deref());
+ let flag_text = &flag_note.text;
+ let flag_after = flag_note.after_green();
+ cformat!(
+ "<green>✓ Removed <bold>{branch_display}</> worktree & branch{flag_text}</>{flag_after}"
+ )
+ } else {
+ // Branch kept: hint will explain why (integrated+flag, unmerged, or unmerged+flag)
+ cformat!("<green>✓ Removed <bold>{branch_display}</> worktree</>")
+ };
+ super::print(FormattedMessage::new(msg))?;
+
+ // Show hints for branch status
+ if !branch_deleted {
+ if deletion_mode.should_keep() && branch_was_integrated {
+ // User kept an integrated branch - show integration info
+ let reason = pre_computed_integration.as_ref().unwrap();
+ let target = effective_target.as_deref().unwrap_or("target");
+ let desc = reason.description();
+ let symbol = reason.symbol();
+ super::print(hint_message(cformat!(
+ "Branch integrated ({desc} <bold>{target}</>, <dim>{symbol}</>); retained with <bright-black>--no-delete-branch</>"
+ )))?;
+ } else if show_unmerged_hint {
+ // Unmerged, no flag - show how to force delete
+ let cmd = suggest_command("remove", &[branch_name], &["-D"]);
+ super::print(hint_message(cformat!(
+ "Branch unmerged; to delete, run <bright-black>{cmd}</>"
+ )))?;
+ }
+ // else: Unmerged + flag - no hint (flag had no effect)
}
print_switch_message_if_changed(changed_directory, main_path)?;
@@ -1172,54 +1169,6 @@ mod tests {
}
}
- #[test]
- fn test_format_remove_worktree_message() {
- // Removed worktree and branch (integrated)
- let msg = format_remove_worktree_message(
- "feature",
- Some("feature"),
- BranchDeletionMode::SafeDelete,
- &BranchDeletionOutcome::Integrated(IntegrationReason::SameCommit),
- Some("main"),
- );
- assert!(msg.as_str().contains("feature"));
- assert!(msg.as_str().contains("worktree & branch"));
- assert!(msg.as_str().contains("same commit as"));
- assert!(msg.as_str().contains("main"));
-
- // Removed worktree only (--no-delete-branch)
- let msg = format_remove_worktree_message(
- "feature",
- Some("feature"),
- BranchDeletionMode::Keep,
- &BranchDeletionOutcome::NotDeleted,
- None,
- );
- assert!(msg.as_str().contains("worktree"));
- assert!(!msg.as_str().contains("& branch"));
- assert!(msg.as_str().contains("--no-delete-branch"));
-
- // Force deleted branch
- let msg = format_remove_worktree_message(
- "feature",
- Some("feature"),
- BranchDeletionMode::ForceDelete,
- &BranchDeletionOutcome::ForceDeleted,
- None,
- );
- assert!(msg.as_str().contains("--force-delete"));
-
- // Unmerged branch retained
- let msg = format_remove_worktree_message(
- "feature",
- Some("feature"),
- BranchDeletionMode::SafeDelete,
- &BranchDeletionOutcome::NotDeleted,
- None,
- );
- assert!(msg.as_str().contains("retaining unmerged branch"));
- }
-
#[test]
fn test_shell_integration_hint() {
let hint = shell_integration_hint();
diff --git a/tests/integration_tests/remove.rs b/tests/integration_tests/remove.rs
index 7739a4927..50ee2ecbf 100644
--- a/tests/integration_tests/remove.rs
+++ b/tests/integration_tests/remove.rs
@@ -385,12 +385,66 @@ fn test_remove_foreground_unmerged(mut repo: TestRepo) {
);
}
+/// Tests foreground removal with --no-delete-branch on an integrated branch.
+/// The hint should show "Branch integrated (reason); retained with --no-delete-branch"
+#[rstest]
+fn test_remove_foreground_no_delete_branch(mut repo: TestRepo) {
+ // Create a worktree (integrated - same commit as main)
+ let _worktree_path = repo.add_worktree("feature-fg-keep");
+
+ // Remove with both --no-background and --no-delete-branch
+ snapshot_remove(
+ "remove_foreground_no_delete_branch",
+ &repo,
+ &["--no-background", "--no-delete-branch", "feature-fg-keep"],
+ None,
+ );
+}
+
+/// Tests foreground removal with --no-delete-branch on an unmerged branch.
+/// No hint needed since the flag had no effect (branch wouldn't be deleted anyway).
+#[rstest]
+fn test_remove_foreground_no_delete_branch_unmerged(mut repo: TestRepo) {
+ // Create a worktree with an unmerged commit
+ let worktree_path = repo.add_worktree("feature-fg-unmerged-keep");
+
+ // Add a commit to the feature branch that's not in main
+ std::fs::write(worktree_path.join("feature.txt"), "new feature").unwrap();
+ repo.git_command(&["add", "feature.txt"])
+ .current_dir(&worktree_path)
+ .output()
+ .unwrap();
+ repo.git_command(&["commit", "-m", "Add feature"])
+ .current_dir(&worktree_path)
+ .output()
+ .unwrap();
+
+ // Go back to main
+ repo.git_command(&["checkout", "main"]).output().unwrap();
+
+ // Remove with both --no-background and --no-delete-branch
+ // No hint because:
+ // - Branch is unmerged (wouldn't be deleted anyway)
+ // - --no-delete-branch had no effect
+ snapshot_remove(
+ "remove_foreground_no_delete_branch_unmerged",
+ &repo,
+ &[
+ "--no-background",
+ "--no-delete-branch",
+ "feature-fg-unmerged-keep",
+ ],
+ None,
+ );
+}
+
#[rstest]
fn test_remove_no_delete_branch(mut repo: TestRepo) {
- // Create a worktree
+ // Create a worktree (integrated - same commit as main)
let _worktree_path = repo.add_worktree("feature-keep");
// Remove worktree but keep the branch using --no-delete-branch flag
+ // Since branch is integrated, the flag has an effect - hint explains this
snapshot_remove(
"remove_no_delete_branch",
&repo,
@@ -399,6 +453,35 @@ fn test_remove_no_delete_branch(mut repo: TestRepo) {
);
}
+#[rstest]
+fn test_remove_no_delete_branch_unmerged(mut repo: TestRepo) {
+ // Create a worktree with an unmerged commit
+ let worktree_path = repo.add_worktree("feature-unmerged-keep");
+
+ // Add a commit to the feature branch that's not in main
+ std::fs::write(worktree_path.join("feature.txt"), "new feature").unwrap();
+ repo.git_command(&["add", "feature.txt"])
+ .current_dir(&worktree_path)
+ .output()
+ .unwrap();
+ repo.git_command(&["commit", "-m", "Add feature"])
+ .current_dir(&worktree_path)
+ .output()
+ .unwrap();
+
+ // Go back to main before removing
+ repo.git_command(&["checkout", "main"]).output().unwrap();
+
+ // Remove worktree with --no-delete-branch flag
+ // Since branch is unmerged, the flag has no effect - no hint shown
+ snapshot_remove(
+ "remove_no_delete_branch_unmerged",
+ &repo,
+ &["--no-delete-branch", "feature-unmerged-keep"],
+ None,
+ );
+}
+
#[rstest]
fn test_remove_branch_only_merged(repo: TestRepo) {
// Create a branch from main without a worktree (already merged)
@@ -490,6 +573,29 @@ fn test_remove_from_detached_head_in_worktree(mut repo: TestRepo) {
);
}
+/// Test foreground removal from a detached HEAD state.
+///
+/// Covers the foreground detached HEAD code path in handlers.rs.
+/// The output should be "✓ Removed worktree (detached HEAD, no branch to delete)".
+///
+/// Ignored on Windows: subprocess tests stay in the worktree, causing file locking errors.
+#[rstest]
+#[cfg_attr(windows, ignore)]
+fn test_remove_foreground_detached_head(mut repo: TestRepo) {
+ let worktree_path = repo.add_worktree("feature-detached-fg");
+
+ // Detach HEAD in the worktree
+ repo.detach_head_in_worktree("feature-detached-fg");
+
+ // Run foreground remove from within the detached worktree
+ snapshot_remove(
+ "remove_foreground_detached_head",
+ &repo,
+ &["--no-background"],
+ Some(&worktree_path),
+ );
+}
+
/// Test that `wt remove @` works from a detached HEAD state in a worktree.
///
/// This should behave identically to `wt remove` (no args) - path-based removal
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
index 543c35985..780ba3a1c 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
@@ -30,5 +30,5 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Removing feature-unmerged worktree in background; retaining unmerged branch
-↳ To delete the unmerged branch, run wt remove feature-unmerged -D
+◎ Removing feature-unmerged worktree in background
+↳ Branch unmerged; to delete, run wt remove feature-unmerged -D
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground_detached_head.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground_detached_head.snap
new file mode 100644
index 000000000..84d71d528
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_foreground_detached_head.snap
@@ -0,0 +1,34 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--no-background"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing current worktree...
+✓ Removed worktree (detached HEAD, no branch to delete)
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch.snap
new file mode 100644
index 000000000..de4c6446b
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch.snap
@@ -0,0 +1,37 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--no-background"
+ - "--no-delete-branch"
+ - feature-fg-keep
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature-fg-keep worktree...
+✓ Removed feature-fg-keep worktree
+↳ Branch integrated (same commit as main, _); retained with --no-delete-branch
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch_unmerged.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch_unmerged.snap
new file mode 100644
index 000000000..97838d305
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_foreground_no_delete_branch_unmerged.snap
@@ -0,0 +1,36 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--no-background"
+ - "--no-delete-branch"
+ - feature-fg-unmerged-keep
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature-fg-unmerged-keep worktree...
+✓ Removed feature-fg-unmerged-keep worktree
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_foreground_unmerged.snap b/tests/snapshots/integration__integration_tests__remove__remove_foreground_unmerged.snap
index 13fd830de..5cab2d4cf 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_foreground_unmerged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_foreground_unmerged.snap
@@ -32,5 +32,5 @@ exit_code: 0
----- stderr -----
◎ Removing feature-unmerged-fg worktree...
-✓ Removed feature-unmerged-fg worktree; retaining unmerged branch
-↳ To delete the unmerged branch, run wt remove feature-unmerged-fg -D
+✓ Removed feature-unmerged-fg worktree
+↳ Branch unmerged; to delete, run wt remove feature-unmerged-fg -D
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch.snap b/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch.snap
index a2bb71e0b..83eb7e228 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch.snap
@@ -31,4 +31,5 @@ exit_code: 0
----- stdout -----
----- stderr -----
-◎ Removing feature-keep worktree in background; retaining branch (--no-delete-branch)
+◎ Removing feature-keep worktree in background
+↳ Branch integrated (same commit as main, _); retained with --no-delete-branch
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch_unmerged.snap b/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch_unmerged.snap
new file mode 100644
index 000000000..53928e4a1
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__remove__remove_no_delete_branch_unmerged.snap
@@ -0,0 +1,34 @@
+---
+source: tests/integration_tests/remove.rs
+info:
+ program: wt
+ args:
+ - remove
+ - "--no-delete-branch"
+ - feature-unmerged-keep
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_EDITOR: ""
+ GIT_TERMINAL_PROMPT: "0"
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ PATH: "[PATH]"
+ RUST_LOG: warn
+ SOURCE_DATE_EPOCH: "1735776000"
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+◎ Removing feature-unmerged-keep worktree in background