Skip to content

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

feat: Improve output for conflicting uncommitted changes

Maximilian Roosc2b2439413a1
diff --git a/src/git/error.rs b/src/git/error.rs
index 3105b07ed..1ce08d697 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -149,15 +149,15 @@ impl std::fmt::Display for GitError {
files,
worktree_path,
} => {
- use crate::styling::AnstyleStyle;
- let dim = AnstyleStyle::new().dimmed();
+ use crate::styling::format_with_gutter;
write!(
f,
"{ERROR_EMOJI} {ERROR}Cannot push: conflicting uncommitted changes in:{ERROR:#}\n\n"
)?;
- for file in files {
- writeln!(f, "{dim}•{dim:#} {file}")?;
+ if !files.is_empty() {
+ let joined_files = files.join("\n");
+ write!(f, "{}", format_with_gutter(&joined_files, "", None))?;
}
write!(
f,
diff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
index ae217e8bb..6a1214d71 100644
--- a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap.snap
@@ -1,5 +1,6 @@
---
source: tests/integration_tests/push.rs
+assertion_line: 13
info:
program: wt
args:
@@ -16,7 +17,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmphd1oIj/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpLjwqDc/test-config.toml
---
success: false
exit_code: 1
@@ -25,6 +26,6 @@ exit_code: 1
----- stderr -----
❌ Cannot push: conflicting uncommitted changes in:
-• conflict.txt
+  conflict.txt
💡 Commit or stash these changes in [REPO] first