mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 18:27:38 +00:00
split: give warning when given paths don't match anything
This commit is contained in:
parent
16d287340a
commit
6e9d3879fd
2 changed files with 16 additions and 3 deletions
|
@ -2591,6 +2591,13 @@ don't make any changes, then the operation will be aborted.
|
||||||
.base_repo()
|
.base_repo()
|
||||||
.store()
|
.store()
|
||||||
.get_tree(&RepoPath::root(), &tree_id)?;
|
.get_tree(&RepoPath::root(), &tree_id)?;
|
||||||
|
if middle_tree.id() == base_tree.id() {
|
||||||
|
writeln!(
|
||||||
|
ui.warning(),
|
||||||
|
"The given paths do not match any file: {}",
|
||||||
|
args.paths.join(" ")
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
let first_template = description_template_for_cmd_split(
|
let first_template = description_template_for_cmd_split(
|
||||||
tx.base_workspace_helper(),
|
tx.base_workspace_helper(),
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::common::TestEnvironment;
|
use crate::common::{get_stderr_string, get_stdout_string, TestEnvironment};
|
||||||
|
|
||||||
pub mod common;
|
pub mod common;
|
||||||
|
|
||||||
|
@ -110,13 +110,19 @@ fn test_split_by_paths() {
|
||||||
|
|
||||||
// Insert an empty commit before @- with "split nonexistent"
|
// Insert an empty commit before @- with "split nonexistent"
|
||||||
test_env.set_up_fake_editor();
|
test_env.set_up_fake_editor();
|
||||||
let stdout = test_env.jj_cmd_success(&repo_path, &["split", "-r", "@-", "nonexistent"]);
|
let assert = test_env
|
||||||
insta::assert_snapshot!(stdout, @r###"
|
.jj_cmd(&repo_path, &["split", "-r", "@-", "nonexistent"])
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
|
||||||
Rebased 1 descendant commits
|
Rebased 1 descendant commits
|
||||||
First part: 0647b2cbd0da (no description set)
|
First part: 0647b2cbd0da (no description set)
|
||||||
Second part: d5d77af65446 (no description set)
|
Second part: d5d77af65446 (no description set)
|
||||||
Working copy now at: 86f228dc3a50 (no description set)
|
Working copy now at: 86f228dc3a50 (no description set)
|
||||||
"###);
|
"###);
|
||||||
|
insta::assert_snapshot!(get_stderr_string(&assert), @r###"
|
||||||
|
The given paths do not match any file: nonexistent
|
||||||
|
"###);
|
||||||
|
|
||||||
let stdout =
|
let stdout =
|
||||||
test_env.jj_cmd_success(&repo_path, &["log", "-T", r#"change_id.short() " " empty"#]);
|
test_env.jj_cmd_success(&repo_path, &["log", "-T", r#"change_id.short() " " empty"#]);
|
||||||
|
|
Loading…
Reference in a new issue