Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* `jj bisect` will now mention when it cannot unambiguously find the first bad
revision due to skips in evaluation.

* The builtin diff now attempts to split changes into smaller hunks by falling
back to the longest common substring algorithm.

### Fixed bugs

* A side of a conflict whose contents end with a carriage return no longer loses
Expand Down
87 changes: 2 additions & 85 deletions cli/tests/test_diff_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1558,89 +1558,6 @@ fn test_diff_color_words_inlining_threshold() {
");
}

#[test]
fn test_diff_color_words_omit_blank_right_line() {
let test_env = TestEnvironment::default();
test_env.run_jj_in(".", ["git", "init", "repo"]).success();
let work_dir = test_env.work_dir("repo");

// The middle hunk of file1 and file3 is
// left = " x\n..."
// right = "\n y\nz "
//
// file2 is different because left/right sides have the same number of "\n".
work_dir.write_file(
"file1",
indoc! {"
a x
b
"},
);
work_dir.write_file(
"file2",
indoc! {"
a x

b
"},
);
work_dir.write_file(
"file3",
indoc! {"
a x


b
"},
);
work_dir.run_jj(["new"]).success();
work_dir.write_file(
"file1",
indoc! {"
a
y
z b
"},
);
work_dir.write_file(
"file2",
indoc! {"
a
y
z b
"},
);
work_dir.write_file(
"file3",
indoc! {"
a
y
z b
"},
);

let output = work_dir
.run_jj(["diff", "--color=always"])
.normalize_stdout_with(strip_ansi_escape_codes);
insta::assert_snapshot!(output, @"
Modified regular file file1:
1 1: a x
2: y
2 3: z b
Modified regular file file2:
1 1: a x
2 2: y
3 3: z b
Modified regular file file3:
1 1: a x
2 :
3 :
2: y
4 3: z b
[EOF]
");
}

#[test]
fn test_diff_missing_newline() {
let test_env = TestEnvironment::default();
Expand Down Expand Up @@ -2950,10 +2867,10 @@ fn test_diff_conflict_bases_differ() {
 7  6: left 3.3
 8 : %%%%%%% diff from: rlvkpnrz 44cfbde6 "base1"
 9 : \\\\\\\ to: royxmykx 3087be1f "right1"
 10 : -line 3
 10 : -line 3
 7: %%%%%%% diff from: vruxwmqv 3c4d67e6 "base2"
 8: \\\\\\\ to: kmkuslsw 656695c3 "right2"
 9: -line 3.1
 9: -line 3.1
 10: -line 3.2
 11  11: +right 3.1
...
Expand Down
Loading
Loading