Hello! Firstly, let me say thank you for creating this library - it is something that I get to enjoy using indirectly through gitoxide
I think we've run into a condition which might generate hunks incorrectly, or at the very least, differently from how git diff produces them.
The problematic change takes the following form:
Before
After
The unidiff I'd expect is
@@ -1,5 +1,3 @@
a
-foo
-
b
However the unidiff I get from imara-diff looks like
@@ -1,5 +1,3 @@
a
-
-foo
b
I need to clarify that this only happens when there are other changes preceding it - if there are no other changes, the unidiff looks as expected (aligned with git's diff output).
In order to make debugging easier, I created a test with the scenario that allowed me to reproduce this - https://github.com/krlvi/imara-diff/blob/f259243ba3873189744b81b7a8d7e0dde58b0700/src/tests.rs#L159
Attaching below a screenshot from the test output (I allowed myself to add pretty_assertions to my branch for better visibility)

Thanks
Hello! Firstly, let me say thank you for creating this library - it is something that I get to enjoy using indirectly through gitoxide
I think we've run into a condition which might generate hunks incorrectly, or at the very least, differently from how git diff produces them.
The problematic change takes the following form:
Before
After
The unidiff I'd expect is
However the unidiff I get from
imara-difflooks likeI need to clarify that this only happens when there are other changes preceding it - if there are no other changes, the unidiff looks as expected (aligned with git's diff output).
In order to make debugging easier, I created a test with the scenario that allowed me to reproduce this - https://github.com/krlvi/imara-diff/blob/f259243ba3873189744b81b7a8d7e0dde58b0700/src/tests.rs#L159
Attaching below a screenshot from the test output (I allowed myself to add

pretty_assertionsto my branch for better visibility)Thanks