From 98c16c4e1919985c39907d99f57bc003e22daad7 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 26 Sep 2024 18:22:54 +0200 Subject: [PATCH] split: do not reference file paths in warning jj split warning was potentially wrong in both interactive and non-interactive modes when everything is put into the child commit: - Non-interactive mode: "The given paths does not match any file: PATHS". The message is misleading, as the PATHS given on the command-line may match files but not match files containing changes. - Interactive mode: "The given paths does not match any file: " while if possible that no paths were given on the command line. --- cli/src/commands/split.rs | 3 +-- cli/tests/test_split_command.rs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index 496172dac6..e3cf845028 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -118,8 +118,7 @@ the operation will be aborted. // The user selected nothing, so the first commit will be empty. writeln!( ui.warning_default(), - "The given paths do not match any file: {}", - args.paths.join(" ") + "No changes have been selected, so the first commit will be empty" )?; } diff --git a/cli/tests/test_split_command.rs b/cli/tests/test_split_command.rs index 376a53844f..99883fb787 100644 --- a/cli/tests/test_split_command.rs +++ b/cli/tests/test_split_command.rs @@ -129,14 +129,14 @@ fn test_split_by_paths() { test_env.set_up_fake_editor(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["split", "-r", "@-", "nonexistent"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Warning: The given paths do not match any file: nonexistent + insta::assert_snapshot!(stderr, @r#" + Warning: No changes have been selected, so the first commit will be empty Rebased 1 descendant commits First part: qpvuntsm bd42f95a (empty) (no description set) Second part: lylxulpl ed55c86b (no description set) Working copy now at: zsuskuln 1e1ed741 (no description set) Parent commit : lylxulpl ed55c86b (no description set) - "###); + "#); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" @ zsuskulnrvyr false