Skip to content

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

Remove extra newline from directive output

Maximilian Roosbcd1dc7c133c
diff --git a/src/output/directive.rs b/src/output/directive.rs
index 032fe8aa0..8bbe44b4e 100644
--- a/src/output/directive.rs
+++ b/src/output/directive.rs
@@ -50,7 +50,6 @@ impl DirectiveOutput {
}
pub fn flush(&mut self) -> io::Result<()> {
- writeln!(io::stdout())?;
io::stdout().flush()?;
io::stderr().flush()
}
diff --git a/tests/integration_tests/e2e_shell.rs b/tests/integration_tests/e2e_shell.rs
index 7bc64b100..a235f66ab 100644
--- a/tests/integration_tests/e2e_shell.rs
+++ b/tests/integration_tests/e2e_shell.rs
@@ -392,3 +392,41 @@ fn test_bash_e2e_multiple_switches() {
output
);
}
+
+#[test]
+fn test_bash_e2e_switch_linebreaks() {
+ if !is_shell_available("bash") {
+ eprintln!("Skipping test: bash not available");
+ return;
+ }
+
+ let repo = TestRepo::new();
+ repo.commit("Initial commit");
+
+ let init_code = generate_init_code(&repo, "bash");
+ let bin_path = get_cargo_bin("wt")
+ .parent()
+ .unwrap()
+ .to_string_lossy()
+ .to_string();
+
+ // Script that switches and immediately echoes a marker to count linebreaks
+ let script = format!(
+ r#"
+ {}
+ {}
+ wt switch --create test-branch 2>&1
+ echo "MARKER"
+ "#,
+ path_export_syntax("bash", &bin_path),
+ init_code
+ );
+
+ let output = execute_shell_script(&repo, "bash", &script);
+
+ // Setup insta settings to normalize paths
+ let settings = crate::common::setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ insta::assert_snapshot!("bash_e2e_switch_linebreaks", output);
+ });
+}
diff --git a/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap
new file mode 100644
index 000000000..8510da29c
Binary files /dev/null and b/tests/snapshots/integration__integration_tests__e2e_shell__bash_e2e_switch_linebreaks.snap differ
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap
index 43bd5ced4..e39a997ae 100644
Binary files a/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap and b/tests/snapshots/integration__integration_tests__remove__remove_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap
index 29c67cc4d..06a036c15 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap and b/tests/snapshots/integration__integration_tests__switch__switch_existing_internal.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap
index 8d87d85c0..2bb96117c 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_mode.snap differ
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap
index 07ef321bd..7a341e349 100644
Binary files a/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap and b/tests/snapshots/integration__integration_tests__switch__switch_internal_with_execute.snap differ