-
-
Notifications
You must be signed in to change notification settings - Fork 413
Description
This is a tracking issue related to what’s known as the “diff slider problem”. When calculating the diff between two versions of a file, a hunk can be ambiguous with respect to where it starts and ends. Consider the following example:
fn test_a_different_thing() {
}
+#[test]
+fn test_something() {
+}
+
#[test]
fn test_something_else() {
} The following diff is, technically speaking, equally valid, even though human readers most likely would prefer the above diff.
fn test_a_different_thing() {
}
#[test]
+fn test_something() {
+}
+
+#[test]
fn test_something_else() {
} gix-diff relies on imara-diff 0.1 under the hood for it’s diffing algorithm. There’s a significant number of cases, though, where imara-diff 0.1 and git diff yield different results as they employ different heuristics with respect to moving ambiguous diff hunks up or down.
There is an experimental feature flag in gix-diff (blob-experimental) that uses imara-diff 0.2. imara-diff 0.2 comes closer to what git diff returns, though it still doesn’t match its output in all cases.
We assume that most people would expect gix-diff to yield the same results as git diff. Based on this assumption, we want to track progress towards closing the gap between gix-diff and git diff with respect to slider placement.
Tasks
- Extract a set of baseline tests for use in
gix-diff/tests - Document how closely
imara-diffmatchesgit diff - Port
git diffpostprocessing heuristic for use withimara-diff0.2
Sources
https://github.com/mhagger/diff-slider-tools
Related
- Add feature flag
blame-experimentaltogix#2307 - Update to
imara-diff0.2 in diff slider test #2288 - Update
gix-blametoimara-diff0.2 #2287 - Add imara-diff v0.2 with slider heuristics support #2286
- Account for "\ No newline at end of file" in baseline diff parser #2285
- Report number of non-matching diffs in slider test #2276
- Exclude
expectrlandimara-difffrom grouped version updates #2269 - Add script to generate tests cases for
gix-diff#2197
- Merged, but later reverted: Add Sink that implements git's diffing improvement heuristics #2011