ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: add test of workspaces with sparse patterns

When adding a new workspace, I would expect that it inherits the
patterns from the workspace I ran the command in. We currently don't
do that. That's quite annoying when your repo has very many files
(like at Google).
This commit is contained in:
Martin von Zweigbergk 2024-02-17 08:48:29 -08:00 committed by Martin von Zweigbergk
parent 89cf6a00a1
commit 6d7affc4da

View file

@ -69,6 +69,31 @@ fn test_workspaces_add_second_workspace() {
"###);
}
/// Test how sparse patterns are inherited
#[test]
fn test_workspaces_sparse_patterns() {
let test_env = TestEnvironment::default();
test_env.jj_cmd_ok(test_env.env_root(), &["init", "--git", "ws1"]);
let ws1_path = test_env.env_root().join("ws1");
let ws2_path = test_env.env_root().join("ws2");
let ws3_path = test_env.env_root().join("ws3");
test_env.jj_cmd_ok(&ws1_path, &["sparse", "set", "--clear", "--add=foo"]);
test_env.jj_cmd_ok(&ws1_path, &["workspace", "add", "../ws2"]);
let stdout = test_env.jj_cmd_success(&ws2_path, &["sparse", "list"]);
// TODO: Should inherit the sparse patterns from ws1
insta::assert_snapshot!(stdout, @r###"
.
"###);
test_env.jj_cmd_ok(&ws2_path, &["sparse", "set", "--add=bar"]);
test_env.jj_cmd_ok(&ws2_path, &["workspace", "add", "../ws3"]);
let stdout = test_env.jj_cmd_success(&ws3_path, &["sparse", "list"]);
// TODO: Should inherit the sparse patterns from ws2
insta::assert_snapshot!(stdout, @r###"
.
"###);
}
/// Test adding a second workspace while the current workspace is editing a
/// merge
#[test]