-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diff: consider uncommon words to match only if they have the same count
Patience diff starts by lining up unique elements (e.g. lines) to find matching segments of the inputs. After that, it refines the non-matching segments by repeating the process. Histogram expands on that by not just considering unique elements but by continuing with elements of count 2, then 3, etc. Before this commit, when diffing "a b a b b" against "a b a b a b", we would match the two "a"s in the first input against the first two "a"s in the second input. After this patch, we ignore the "a"s because their counts differ, so we try to align the "b"s instead. I have had this commit lying around since I wrote the histogram diff implementation in 1e657c5. I vaguely remember thinking that the way I had implemented it (without this commit) was a bit weird, but I wasn't sure if this commit would be an improvement or not. The bug report from @chooglen today of a case where we behave differently from Git is enough to make me think that we make this change after all. #761
- Loading branch information
1 parent
cbcbf11
commit 280026a
Showing
3 changed files
with
49 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,13 +59,13 @@ fn test_obslog_with_or_without_diff() { | |
@ rlvkpnrz [email protected] 2001-02-03 08:05:10 66b42ad3 | ||
│ my description | ||
│ Resolved conflict in file1: | ||
│ 1 1: <<<<<<< Conflict 1 of 1resolved | ||
│ 1 : <<<<<<< Conflict 1 of 1 | ||
│ 2 : %%%%%%% Changes from base to side #1 | ||
│ 3 : -foo | ||
│ 4 : +++++++ Contents of side #2 | ||
│ 5 : foo | ||
│ 6 : bar | ||
│ 7 : >>>>>>> Conflict 1 of 1 ends | ||
│ 7 1: >>>>>>> Conflict 1 of 1 endsresolved | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 cf73917d conflict | ||
│ my description | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 08:05:09 068224a7 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters