Skip to content

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

refactor(success-messages): Clarify no-action messages and update snapshot

Maximilian Rooscc9a7ad18222
diff --git a/src/commands/merge.rs b/src/commands/merge.rs
index 3b33d0d1f..53e193e74 100644
--- a/src/commands/merge.rs
+++ b/src/commands/merge.rs
@@ -220,29 +220,21 @@ pub fn handle_merge(
Ok(())
}
-/// Format the merge summary message (no emoji - output system adds it)
-fn format_merge_summary(main_path: Option<&std::path::Path>) -> String {
+/// Handle output for merge summary using global output context
+fn handle_merge_summary_output(main_path: Option<&std::path::Path>) -> anyhow::Result<()> {
use worktrunk::styling::GREEN;
- // Show where we ended up
if let Some(path) = main_path {
- format!(
+ // Action completed: moved to main worktree
+ crate::output::success(format!(
"{GREEN}Returned to main at {GREEN_BOLD}{}{GREEN_BOLD:#}{GREEN:#}",
format_path_for_display(path)
- )
+ ))?;
} else {
- format!("{GREEN}Worktree preserved (--no-remove){GREEN:#}")
+ // No action: worktree stayed as-is (acknowledging --no-remove flag)
+ crate::output::info("Worktree preserved (--no-remove)")?;
}
-}
-
-/// Handle output for merge summary using global output context
-fn handle_merge_summary_output(main_path: Option<&std::path::Path>) -> anyhow::Result<()> {
- let message = format_merge_summary(main_path);
-
- // Show success message (formatting added by OutputContext)
- crate::output::success(message)?;
- // Flush output
crate::output::flush()?;
Ok(())
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index c4700d600..4a07cef8b 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -107,7 +107,9 @@ use worktrunk::git::{
not_fast_forward, push_failed, worktree_creation_failed, worktree_missing,
worktree_path_exists, worktree_path_occupied,
};
-use worktrunk::styling::{CYAN, CYAN_BOLD, GREEN, GREEN_BOLD, WARNING, format_with_gutter};
+use worktrunk::styling::{
+ AnstyleStyle, CYAN, CYAN_BOLD, GREEN, GREEN_BOLD, WARNING, format_with_gutter,
+};
use super::command_executor::CommandContext;
use super::hooks::{HookFailureStrategy, HookPipeline};
@@ -626,15 +628,11 @@ pub fn handle_push(
summary_parts.join(", ")
))?;
} else {
- // No commits to push - show current HEAD commit info
- let head_sha = repo
- .run_command(&["rev-parse", "--short", "HEAD"])?
- .trim()
- .to_string();
- let green_dim = GREEN.dimmed();
+ // No commits to push - state description without action verb
+ let bold = AnstyleStyle::new().bold();
- // For merge workflow context, acknowledge operations that didn't happen
- let note = if let Some(ops) = operations {
+ // For merge workflow context, explain why nothing was pushed
+ let context = if let Some(ops) = operations {
let mut notes = Vec::new();
if !ops.committed && !ops.squashed {
notes.push("no new commits");
@@ -643,17 +641,17 @@ pub fn handle_push(
notes.push("no rebase needed");
}
if notes.is_empty() {
- "already up to date".to_string()
+ String::new()
} else {
- notes.join(", ")
+ format!(" ({})", notes.join(", "))
}
} else {
- // Standalone push - no merge workflow context
- "already up to date".to_string()
+ String::new()
};
- crate::output::success(format!(
- "{GREEN}{verb} {GREEN_BOLD}{target_branch}{GREEN_BOLD:#}{GREEN} @ {green_dim}{head_sha}{green_dim:#} ({note}){GREEN:#}"
+ // No action: nothing was pushed, just acknowledging state
+ crate::output::info(format!(
+ "Already up to date with {bold}{target_branch}{bold:#}{context}"
))?;
}
diff --git a/src/main.rs b/src/main.rs
index 1f2fd00ba..c2f093324 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -306,7 +306,8 @@ fn main() {
"Configured {changes_count} shell{plural}"
))?;
} else {
- crate::output::success("All shells already configured")?;
+ // No action: all shells were already configured
+ crate::output::info("All shells already configured")?;
}
// Restart hint for current shell (only if config files changed, not just completions)
diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rs
index a8467dabf..a8be8c58a 100644
--- a/tests/integration_tests/configure_shell.rs
+++ b/tests/integration_tests/configure_shell.rs
@@ -118,7 +118,7 @@ fn test_configure_shell_already_exists() {
exit_code: 0
----- stdout -----
⚪ Already configured shell extension & completions for zsh @ ~/.zshrc
- ✅ All shells already configured
+ ⚪ All shells already configured
----- stderr -----
");
diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rs
index 6a4c015ae..8581e468d 100644
--- a/tests/integration_tests/merge.rs
+++ b/tests/integration_tests/merge.rs
@@ -2234,7 +2234,7 @@ fn test_merge_no_commit_with_clean_tree() {
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
- ✅ Worktree preserved (--no-remove)
+ ⚪ Worktree preserved (--no-remove)
----- stderr -----
");
@@ -2337,7 +2337,7 @@ fn test_merge_no_commit_no_squash_no_remove_redundant() {
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
- ✅ Worktree preserved (--no-remove)
+ ⚪ Worktree preserved (--no-remove)
----- stderr -----
");
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
index 3f0426afd..12264c6a7 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge.snap
@@ -2,5 +2,5 @@
source: tests/integration_tests/shell_wrapper.rs
expression: output.normalized()
---
-✅ Merged to main @ [HASH] (no new commits, no rebase needed)
-✅ Worktree preserved (--no-remove)
+⚪ Already up to date with main (no new commits, no rebase needed)
+⚪ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap
index dbd21de2a..7629fcc89 100644
--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__directives__merge_internal_no_remove.snap
@@ -30,4 +30,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-✅ Worktree preserved (--no-remove)
+⚪ Worktree preserved (--no-remove)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap
index 0247706d5..4a1487ec4 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_already_on_target.snap
@@ -20,7 +20,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Merged to main @ [SHA] (no new commits, no rebase needed)
-✅ Worktree preserved (--no-remove)
+⚪ Already up to date with main (no new commits, no rebase needed)
+⚪ Worktree preserved (--no-remove)
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap
index 0247706d5..4a1487ec4 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_default_branch_missing_worktree.snap
@@ -20,7 +20,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Merged to main @ [SHA] (no new commits, no rebase needed)
-✅ Worktree preserved (--no-remove)
+⚪ Already up to date with main (no new commits, no rebase needed)
+⚪ Worktree preserved (--no-remove)
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
index 0ce6ebb5e..a97a5d1e3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
@@ -21,7 +21,7 @@ info:
success: true
exit_code: 0
----- stdout -----
-✅ Merged to main @ [SHA] (no new commits, no rebase needed)
+⚪ Already up to date with main (no new commits, no rebase needed)
🔄 Removing no-commits worktree & branch in background
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
index 9bfee154c..a8f28a124 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_race_condition_before_new_commit.snap
@@ -27,6 +27,6 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-✅ Worktree preserved (--no-remove)
+⚪ Worktree preserved (--no-remove)
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
index eeb030b9b..549d3981a 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
@@ -22,7 +22,7 @@ success: true
exit_code: 0
----- stdout -----
✅ Fast-forwarded to main
-✅ Merged to main @ [SHA] (no new commits)
+⚪ Already up to date with main (no new commits)
🔄 Removing fast-forward-test worktree & branch in background
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
index 4b372ab01..3a3dab504 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
@@ -31,7 +31,7 @@ exit_code: 0
  - Change 2
  - Revert to initial
⚪ No changes after squashing 3 commits
-✅ Merged to main @ [SHA] (no new commits, no rebase needed)
+⚪ Already up to date with main (no new commits, no rebase needed)
🔄 Removing feature worktree & branch in background
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
index 9bfee154c..a8f28a124 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_no_remove.snap
@@ -27,6 +27,6 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-✅ Worktree preserved (--no-remove)
+⚪ Worktree preserved (--no-remove)
----- stderr -----