Skip to content

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

Fix ConflictingChanges error message formatting

Maximilian Roosb43320518ac7
diff --git a/src/git/error.rs b/src/git/error.rs
index 25f6e5048..1a12d9c1a 100644
--- a/src/git/error.rs
+++ b/src/git/error.rs
@@ -305,9 +305,9 @@ impl std::fmt::Display for GitError {
files,
worktree_path,
} => {
- write!(
+ writeln!(
f,
- "{}\n\n",
+ "{}",
error_message("Cannot push: conflicting uncommitted changes in:")
)?;
if !files.is_empty() {
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__conflicting_changes.snap b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__conflicting_changes.snap
index 2ff166bf4..b3c87f216 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__conflicting_changes.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__git_error_display__conflicting_changes.snap
@@ -1,9 +1,8 @@
---
-source: tests/git_error_display.rs
+source: tests/integration_tests/git_error_display.rs
expression: err.to_string()
---
❌ Cannot push: conflicting uncommitted changes in:
-
  src/main.rs
  src/lib.rs
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
index 0d1809dc3..1c55acfe4 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_error_conflicting_changes.snap
@@ -6,6 +6,7 @@ info:
- merge
- main
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -13,10 +14,16 @@ info:
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: false
exit_code: 1
@@ -24,7 +31,6 @@ exit_code: 1
----- stderr -----
❌ Cannot push: conflicting uncommitted changes in:
-
  shared.txt
πŸ’‘ Commit or stash these changes in [REPO].main-wt first
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 4de0d0797..06818ff5f 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
@@ -7,6 +7,7 @@ info:
- push
- main
env:
+ APPDATA: "[TEST_CONFIG_HOME]"
CLICOLOR_FORCE: "1"
COLUMNS: "150"
GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
@@ -14,10 +15,16 @@ info:
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: false
exit_code: 1
@@ -25,7 +32,6 @@ exit_code: 1
----- stderr -----
❌ Cannot push: conflicting uncommitted changes in:
-
  conflict.txt
πŸ’‘ Commit or stash these changes in [REPO] first
diff --git a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap_renamed_file.snap b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap_renamed_file.snap
index fcb7dd7e1..f384eb0c7 100644
--- a/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap_renamed_file.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_dirty_target_overlap_renamed_file.snap
@@ -15,10 +15,12 @@ info:
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]"
@@ -30,7 +32,6 @@ exit_code: 1
----- stderr -----
❌ Cannot push: conflicting uncommitted changes in:
-
  file.txt
πŸ’‘ Commit or stash these changes in [REPO] first