diff --git a/cli/src/formatter.rs b/cli/src/formatter.rs index 2d8b97a54a..c81bda7640 100644 --- a/cli/src/formatter.rs +++ b/cli/src/formatter.rs @@ -514,7 +514,7 @@ impl Write for ColorFormatter { labels: &[String], debug: bool, ) -> io::Result<()> { - if debug { + if debug && !labels.is_empty() { write!(output, "<<{}::", labels.join(" "))?; write_sanitized(output, buf)?; write!(output, ">>")?; diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 7db6f4ddb3..8c16ea8c73 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -490,9 +490,9 @@ fn test_color_ui_messages() { // debugging colors let (stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["st", "--color", "debug"]); insta::assert_snapshot!(stdout, @r###" - <<::The working copy is clean>> - <<::Working copy : >><><><><><><><><><><<::>> - <<::Parent commit: >><><><<:: >><><><<:: >><><<:: >><><<::>> + The working copy is clean + Working copy : <><><><><><><><><> + Parent commit: <><> <><> <> <> "###); }