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

sparse: deduplicate edited patterns

Since "set --add" removes duplicated patterns, it makes sense for "edit" to do
the same thing.
This commit is contained in:
Yuya Nishihara 2024-03-28 23:14:01 +09:00
parent 28e4331787
commit db94848341
2 changed files with 2 additions and 1 deletions

View file

@ -145,6 +145,7 @@ fn cmd_sparse_edit(
update_sparse_patterns_with(ui, &mut workspace_command, |_ui, old_patterns| {
let mut new_patterns = edit_sparse(&repo_path, old_patterns, command.settings())?;
new_patterns.sort_unstable();
new_patterns.dedup();
Ok(new_patterns)
})
}

View file

@ -159,7 +159,7 @@ fn test_sparse_manage_patterns() {
"###);
// Can edit with multiple files
edit_patterns(&["file3", "file2"]);
edit_patterns(&["file3", "file2", "file3"]);
let (stdout, stderr) = test_env.jj_cmd_ok(&sub_dir, &["sparse", "edit"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @r###"