Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(git): Normalize stderr output to prevent instability
Maximilian Roos9fcb9fab3f64
diff --git a/src/git.rs b/src/git.rsindex f5317ec37..b3c739ec2 100644--- a/src/git.rs+++ b/src/git.rs@@ -939,11 +939,14 @@ impl Repository {if !output.status.success() {let stderr = String::from_utf8_lossy(&output.stderr);+ // Normalize carriage returns to newlines for consistent output+ // Git uses \r for progress updates; in non-TTY contexts this causes snapshot instability+ let stderr = stderr.replace('\r', "\n");// Log errors with ! prefixfor line in stderr.trim().lines() {log::debug!(" ! {}", line);}- return Err(GitError::CommandFailed(stderr.into_owned()));+ return Err(GitError::CommandFailed(stderr));}let stdout = String::from_utf8_lossy(&output.stdout).into_owned();diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snapindex 46c27d504..3cf090880 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_conflict.snap@@ -12,10 +12,11 @@ info:GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"GIT_CONFIG_GLOBAL: /dev/nullGIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpDxsSjV/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpr5RlUa/test-config.toml---success: falseexit_code: 1@@ -25,7 +26,8 @@ exit_code: 1----- stderr -----❌ [31mRebase onto [0m[1m[31mmain[0m[31m incomplete[0m-[40m [0m Rebasing (1/1) error: could not apply [SHA]... Update shared.txt in feature+[40m [0m Rebasing (1/1)+[40m [0m error: could not apply [SHA]... Update shared.txt in feature[40m [0m hint: Resolve all conflicts manually, mark them as resolved with[40m [0m hint: "git add/rm <conflicted_files>", then run "git rebase --continue".[40m [0m hint: You can instead skip this commit: run "git rebase --skip".