diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index a590c2aae1..3c4cadf07d 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -349,13 +349,21 @@ impl<'a> DiffRenderer<'a> { ) -> Result<(), DiffRenderError> { let from_tree = commit.parent_tree(self.repo)?; let to_tree = commit.tree()?; + let mut copy_records = CopyRecords::default(); + for parent_id in commit.parent_ids() { + copy_records.add_records(self.repo.store().get_copy_records( + None, + parent_id, + commit.id(), + )?)?; + } self.show_diff( ui, formatter, &from_tree, &to_tree, matcher, - &Default::default(), + ©_records, width, ) } diff --git a/cli/tests/test_show_command.rs b/cli/tests/test_show_command.rs index 93bcbce1f2..3c1576cc5c 100644 --- a/cli/tests/test_show_command.rs +++ b/cli/tests/test_show_command.rs @@ -62,8 +62,7 @@ fn test_show_basic() { 1 1: foo 2: bar 2 3: baz quxquux - Added regular file file3: - 1: foo + Modified regular file file3 (file1 => file3): "###); let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--context=0"]); @@ -81,8 +80,7 @@ fn test_show_basic() { 1 1: foo 2: bar 2 3: baz quxquux - Added regular file file3: - 1: foo + Modified regular file file3 (file1 => file3): "###); let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--color=debug"]); @@ -100,8 +98,7 @@ fn test_show_basic() { <><><><> <><><><> <><><><><><><> - <> - <><><><> + < file3):>> "###); let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s"]); @@ -113,9 +110,8 @@ fn test_show_basic() { (no description set) - D file1 M file2 - A file3 + R {file1 => file3} "###); let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--types"]); @@ -242,9 +238,8 @@ fn test_show_basic() { (no description set) - D file1 M file2 - A file3 + R {file1 => file3} diff --git a/file1 b/file1 deleted file mode 100644 index 257cc5642c..0000000000 @@ -279,10 +274,9 @@ fn test_show_basic() { (no description set) - file1 | 1 - - file2 | 3 ++- - file3 | 1 + - 3 files changed, 3 insertions(+), 2 deletions(-) + file2 | 3 ++- + {file1 => file3} | 0 + 2 files changed, 2 insertions(+), 1 deletion(-) "###); }