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.rsindex 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.snapindex 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* [33m6551244[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snapindex 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* [33m4af48f0[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snapindex 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* [33m27eb169[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Squash commits from main-file1.txt | 1 [32m+[m+ file1.txt | 1 [32m+[mfile2.txt | 1 [32m+[mfile3.txt | 1 [32m+[m3 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.snapindex 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* [33m091f0c5[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Squash commits from main-file1.txt | 1 [32m+[m+ file1.txt | 1 [32m+[mfile2.txt | 1 [32m+[m2 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.snapindex 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* [33m525a81f[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m feat: single commit-file1.txt | 1 [32m+[m+ file1.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snapindex 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* [33mffa5181[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Squash commits from main-auth.txt | 1 [32m+[m+ auth.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snapindex 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* [33m6551244[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_keep.snapindex 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* [33m6551244[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_fast_forward.snapindex 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* [33mc2e2bcc[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add test file-test.txt | 1 [32m+[m+ test.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__push__push_not_fast_forward.snapindex 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* [33m4af48f0[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0mdiff --git a/tests/snapshots/integration__integration_tests__push__push_to_default.snap b/tests/snapshots/integration__integration_tests__push__push_to_default.snapindex 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* [33m6551244[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file-feature.txt | 1 [32m+[m+ feature.txt | 1 [32m+[m1 file changed, 1 insertion(+)β [32mPushed to [1m[32mmain[0m (1 commit, 1 file, [32m+1[0m) [0m