Closed mrkkrp closed 2 years ago
I'm surprised that this did not come up earlier and I did not notice it before...
I'm surprised that this did not come up earlier and I did not notice it before...
Personally, I think I never looked at the diffs produced by Ormolu more than in a binary "oh, it is not yet formatted" fashion, but rather used the diffing of the git project I was formatting afterwards for inspection. One possibility would be to just shell out to git diff
if available, and don't display diffs otherwise, but the diff printing code in Ormolu is not that large/complex that this seems like a priority.
git diff
approach is what was used before. I think there is a problem with it though, git diffing and Ormolu diffing are not always the same, in particular, they are not the same in the presence of intermediate editing. Actually IIRC that was the reason for adding built-in diffing in Ormolu: if I wanted to check on CI with Ormolu I had to use git diff
, but my script also did some other editing and it interfered with the results.
One could use git diff --no-index
to just use the diffing part and ignoring any actual git-related functionality.
When diffing these two inputs:
and
The result is
which is not correct. Instead of the line with
where
it is the line with<*> toPermutationWithDefault 'y' (char 'b')
that should follow. Proper diff reports:We should match that.
This seems to have been broken ever since I introduced the functionality for nice displaying of diffs.