Skip to content

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

Fix: Trim trailing newline from diff stat output

Maximilian Roos83f8eb04d673
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index b50e05e5c..90cdc68f9 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -704,8 +704,9 @@ pub fn handle_push(target: Option<&str>, allow_merge_commits: bool) -> Result<()
&format!("{}..HEAD", target_branch),
])?;
- if !diff_stat.trim().is_empty() {
- println!("{}", diff_stat.trim());
+ let diff_stat = diff_stat.trim_end();
+ if !diff_stat.is_empty() {
+ println!("{}", diff_stat);
println!();
}
}
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
index 0e61ca802..2162a1c4a 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -24,7 +24,7 @@ exit_code: 0
* 6551244 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
index 31c35de65..7de053239 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
@@ -24,7 +24,7 @@ exit_code: 0
* 4af48f0 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index 469e4b44e..53a73f275 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -27,7 +27,7 @@ exit_code: 0
* 27eb169 (HEAD -> feature) Squash commits from main
-file1.txt | 1 +
+ file1.txt | 1 +
file2.txt | 1 +
file3.txt | 1 +
3 files changed, 3 insertions(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
index 8c6a2c3cf..02d2ffc5f 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
@@ -28,7 +28,7 @@ exit_code: 0
* 091f0c5 (HEAD -> feature) Squash commits from main
-file1.txt | 1 +
+ file1.txt | 1 +
file2.txt | 1 +
2 files changed, 2 insertions(+)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
index 1197a06e8..ede2fdd9c 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
@@ -26,7 +26,7 @@ exit_code: 0
* 525a81f (HEAD -> feature) feat: single commit
-file1.txt | 1 +
+ file1.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
index 27663bd78..9cc6e8256 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
@@ -29,7 +29,7 @@ exit_code: 0
* ffa5181 (HEAD -> feature) Squash commits from main
-auth.txt | 1 +
+ auth.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
index 6d7084036..c19a5e421 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
@@ -23,7 +23,7 @@ exit_code: 0
* 6551244 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
index 65af24e71..2c63f861f 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap
@@ -25,7 +25,7 @@ exit_code: 0
* 6551244 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
index 6e60e5d65..ba85292a5 100644
--- a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap
@@ -23,7 +23,7 @@ exit_code: 0
* c2e2bcc (HEAD -> feature) Add test file
-test.txt | 1 +
+ test.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
index 905765756..6b8165885 100644
--- a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap
@@ -23,7 +23,7 @@ exit_code: 0
* 4af48f0 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1) 
diff --git a/tests/snapshots/integration__integration_tests__push__push_to_default.snap b/tests/snapshots/integration__integration_tests__push__push_to_default.snap
index 956ce36f5..39d7da955 100644
--- a/tests/snapshots/integration__integration_tests__push__push_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__push__push_to_default.snap
@@ -22,7 +22,7 @@ exit_code: 0
* 6551244 (HEAD -> feature) Add feature file
-feature.txt | 1 +
+ feature.txt | 1 +
1 file changed, 1 insertion(+)
βœ… Pushed to main (1 commit, 1 file, +1)