mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
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:
parent
28e4331787
commit
db94848341
2 changed files with 2 additions and 1 deletions
|
@ -145,6 +145,7 @@ fn cmd_sparse_edit(
|
||||||
update_sparse_patterns_with(ui, &mut workspace_command, |_ui, old_patterns| {
|
update_sparse_patterns_with(ui, &mut workspace_command, |_ui, old_patterns| {
|
||||||
let mut new_patterns = edit_sparse(&repo_path, old_patterns, command.settings())?;
|
let mut new_patterns = edit_sparse(&repo_path, old_patterns, command.settings())?;
|
||||||
new_patterns.sort_unstable();
|
new_patterns.sort_unstable();
|
||||||
|
new_patterns.dedup();
|
||||||
Ok(new_patterns)
|
Ok(new_patterns)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ fn test_sparse_manage_patterns() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Can edit with multiple files
|
// 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"]);
|
let (stdout, stderr) = test_env.jj_cmd_ok(&sub_dir, &["sparse", "edit"]);
|
||||||
insta::assert_snapshot!(stdout, @"");
|
insta::assert_snapshot!(stdout, @"");
|
||||||
insta::assert_snapshot!(stderr, @r###"
|
insta::assert_snapshot!(stderr, @r###"
|
||||||
|
|
Loading…
Reference in a new issue