Skip to content

Commit

Permalink
cli: add test of workspaces with sparse patterns
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
martinvonz committed Feb 17, 2024
1 parent 89cf6a0 commit 78dde34
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cli/tests/test_workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 78dde34

Please sign in to comment.