mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-19 10:44:58 +00:00
print_conflicted_paths: simplify file conflicts before printing
This commit is contained in:
parent
716ec37560
commit
9d4ac81c27
3 changed files with 5 additions and 6 deletions
|
@ -1840,6 +1840,7 @@ pub fn print_conflicted_paths(
|
|||
.map(|p| format!("{:width$}", p, width = max_path_len.min(32) + 3));
|
||||
|
||||
for ((_, conflict), formatted_path) in std::iter::zip(conflicts.iter(), formatted_paths) {
|
||||
let conflict = conflict.clone().simplify();
|
||||
let sides = conflict.num_sides();
|
||||
let n_adds = conflict.adds().flatten().count();
|
||||
let deletions = sides - n_adds;
|
||||
|
|
|
@ -523,11 +523,10 @@ fn test_simplify_conflict_sides() {
|
|||
fileA: Ok(Conflicted([Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })]))
|
||||
fileB: Ok(Conflicted([Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false })]))
|
||||
"###);
|
||||
// TODO: The conflict should be simplified before being displayed.
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
|
||||
@r###"
|
||||
fileA 4-sided conflict
|
||||
fileB 4-sided conflict
|
||||
fileA 2-sided conflict
|
||||
fileB 2-sided conflict
|
||||
"###);
|
||||
insta::assert_snapshot!(
|
||||
std::fs::read_to_string(repo_path.join("fileA")).unwrap(), @r###"
|
||||
|
|
|
@ -207,13 +207,12 @@ fn test_status_simplify_conflict_sides() {
|
|||
&[],
|
||||
);
|
||||
|
||||
// TODO: The conflict should be simplified before being displayed.
|
||||
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["status"]),
|
||||
@r###"
|
||||
The working copy is clean
|
||||
There are unresolved conflicts at these paths:
|
||||
fileA 4-sided conflict
|
||||
fileB 4-sided conflict
|
||||
fileA 2-sided conflict
|
||||
fileB 2-sided conflict
|
||||
Working copy : nkmrtpmo 7b1cdcaa conflict | (conflict) (empty) conflict
|
||||
Parent commit: kmkuslsw 18c1fb00 conflictA | (conflict) (empty) conflictA
|
||||
Parent commit: lylxulpl d11c92eb conflictB | (conflict) (empty) conflictB
|
||||
|
|
Loading…
Reference in a new issue