ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib
Martin von Zweigbergk fefe07b3c3 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 1e657c5331. 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
2024-07-09 20:35:36 +09:00
..
benches
gen-protos
proc-macros cargo: explicitly indicate paths to publish 2024-04-15 20:37:00 -07:00
src diff: consider uncommon words to match only if they have the same count 2024-07-09 20:35:36 +09:00
tests workspace: abandon discardable working copy on forget 2024-07-04 19:37:56 -05:00
testutils copy-tracking: stub get_copy_records 2024-07-03 20:26:30 -04:00
Cargo.toml copy-tracking: cargo add gix-format and gix diff-blob feature 2024-07-03 20:26:30 -04:00
LICENSE