Skip to content

Commit 6692352

Browse files
max-sixtyclaude
andauthored
refactor(output): downgrade 'no worktree' message to info (#887)
When removing a branch that has no associated worktree, the message 'No worktree found for branch X' was shown as a warning (▲). This is now an info message (○) since the branch exists and removal proceeds normally. The BranchOnly code path is only reached when the branch exists locally (checked at repository_ext.rs:116), so this isn't a 'something doesn't exist' warning scenario — it's purely informational. Co-authored-by: Claude <noreply@anthropic.com>
1 parent f429f63 commit 6692352

8 files changed

+16
-9
lines changed

src/output/handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@ fn handle_branch_only_output(
545545
))
546546
);
547547
} else {
548-
// No worktree at all - warn since user asked to remove something that doesn't exist
548+
// No worktree at all, but branch exists - informational since branch removal will proceed
549549
eprintln!(
550550
"{}",
551-
warning_message(cformat!(
551+
info_message(cformat!(
552552
"No worktree found for branch <bold>{branch_name}</>"
553553
))
554554
);

tests/snapshots/integration__integration_tests__remove__remove_branch_matching_tree_content.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ info:
2525
TERM: alacritty
2626
USERPROFILE: "[TEST_HOME]"
2727
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
28+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2829
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
2930
WT_TEST_DELAYED_STREAM_MS: "-1"
3031
WT_TEST_EPOCH: "1735776000"
@@ -35,5 +36,5 @@ exit_code: 0
3536
----- stdout -----
3637

3738
----- stderr -----
38-
[33m▲[39m [33mNo worktree found for branch [1mfeature-squashed[22m[39m
39+
[2m○[22m No worktree found for branch [1mfeature-squashed[22m
3940
Removed branch feature-squashed (tree matches main, ⊂)

tests/snapshots/integration__integration_tests__remove__remove_branch_no_worktree_path_occupied.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ info:
2525
TERM: alacritty
2626
USERPROFILE: "[TEST_HOME]"
2727
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
28+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2829
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
2930
WT_TEST_DELAYED_STREAM_MS: "-1"
3031
WT_TEST_EPOCH: "1735776000"
@@ -35,5 +36,5 @@ exit_code: 0
3536
----- stdout -----
3637

3738
----- stderr -----
38-
[33m▲[39m [33mNo worktree found for branch [1mnpm[22m[39m
39+
[2m○[22m No worktree found for branch [1mnpm[22m
3940
Removed branch npm (same commit as main, _)

tests/snapshots/integration__integration_tests__remove__remove_branch_only_force_delete.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ info:
2626
TERM: alacritty
2727
USERPROFILE: "[TEST_HOME]"
2828
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
29+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2930
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
3031
WT_TEST_DELAYED_STREAM_MS: "-1"
3132
WT_TEST_EPOCH: "1735776000"
@@ -36,5 +37,5 @@ exit_code: 0
3637
----- stdout -----
3738

3839
----- stderr -----
39-
[33m▲[39m [33mNo worktree found for branch [1mfeature-force[22m[39m
40+
[2m○[22m No worktree found for branch [1mfeature-force[22m
4041
Removed branch feature-force (--force-delete)

tests/snapshots/integration__integration_tests__remove__remove_branch_only_merged.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ info:
2525
TERM: alacritty
2626
USERPROFILE: "[TEST_HOME]"
2727
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
28+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2829
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
2930
WT_TEST_DELAYED_STREAM_MS: "-1"
3031
WT_TEST_EPOCH: "1735776000"
@@ -35,5 +36,5 @@ exit_code: 0
3536
----- stdout -----
3637

3738
----- stderr -----
38-
[33m▲[39m [33mNo worktree found for branch [1mfeature-merged[22m[39m
39+
[2m○[22m No worktree found for branch [1mfeature-merged[22m
3940
Removed branch feature-merged (same commit as main, _)

tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ info:
2525
TERM: alacritty
2626
USERPROFILE: "[TEST_HOME]"
2727
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
28+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2829
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
2930
WT_TEST_DELAYED_STREAM_MS: "-1"
3031
WT_TEST_EPOCH: "1735776000"
@@ -35,6 +36,6 @@ exit_code: 0
3536
----- stdout -----
3637

3738
----- stderr -----
38-
[33m▲[39m [33mNo worktree found for branch [1mfeature-unmerged[22m[39m
39+
[2m○[22m No worktree found for branch [1mfeature-unmerged[22m
3940
○ Branch feature-unmerged retained; has unmerged changes
4041
↳ To delete the unmerged branch, run wt remove feature-unmerged -D

tests/snapshots/integration__integration_tests__remove__remove_detached_worktree_in_multi.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ info:
2626
TERM: alacritty
2727
USERPROFILE: "[TEST_HOME]"
2828
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
29+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2930
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
3031
WT_TEST_DELAYED_STREAM_MS: "-1"
3132
WT_TEST_EPOCH: "1735776000"
@@ -38,6 +39,6 @@ exit_code: 0
3839
----- stderr -----
3940
Removing feature-a worktree in background
4041
↳ Branch unmerged; to delete, run wt remove feature-a -D
41-
[33m▲[39m [33mNo worktree found for branch [1mfeature-b[22m[39m
42+
[2m○[22m No worktree found for branch [1mfeature-b[22m
4243
○ Branch feature-b retained; has unmerged changes
4344
↳ To delete the unmerged branch, run wt remove feature-b -D

tests/snapshots/integration__integration_tests__remove__remove_squash_merged_then_main_advanced.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ info:
2525
TERM: alacritty
2626
USERPROFILE: "[TEST_HOME]"
2727
WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
28+
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
2829
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
2930
WT_TEST_DELAYED_STREAM_MS: "-1"
3031
WT_TEST_EPOCH: "1735776000"
@@ -35,5 +36,5 @@ exit_code: 0
3536
----- stdout -----
3637

3738
----- stderr -----
38-
[33m▲[39m [33mNo worktree found for branch [1mfeature-squash[22m[39m
39+
[2m○[22m No worktree found for branch [1mfeature-squash[22m
3940
Removed branch feature-squash (all changes in main, ⊂)

0 commit comments

Comments
 (0)