diff.rs icon indicating copy to clipboard operation
diff.rs copied to clipboard

Bad diff in (at least) one crate

Open Alphare opened this issue 6 months ago • 1 comments

Hi, it's been a while! Glad to see this project's still going.

I was in the process of upgrading a dependency and saw an alarmingly huge diff. As you can see, it looks like the whole project's been rewritten!

Upon further inspection and looking for a simple case, I saw that the changelog had a very suspicious diff. Most of it should just be identical, with the 8.0.0 lines added.

So I cloned the repo, ran git diff --ws-error-highlight=new,old 7.0.3 8.0.0 CHANGELOG.md (the whitespace flag is here in case there's something funky going on) and, sure enough, the diff is much smaller there.

I don't have time to do more digging (I typed "diffing" here by accident heh), so I thought I'd leave a bug report.

Alphare avatar Jul 16 '25 21:07 Alphare

I don't think diff.rs shows you a bad diff. While there may not be changes in the git diff, I think the issue is that version 7.0.3 was published from Windows, and 8.0.0 from Linux.

You have to diff the versions that are uploaded to crates.io, not the diff from the git repository.

$ file ~/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/which-7.0.3/CHANGELOG.md
/Users/pigeonf/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/which-7.0.3/CHANGELOG.md: ASCII text, with CRLF line terminators
$ file ~/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/which-8.0.0/CHANGELOG.md
/Users/pigeonf/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/which-8.0.0/CHANGELOG.md: ASCII tex

As you can see, the uploaded files have different line endings, which leads to the huge diffs.

P.S. This is probably due to the git core.autocrlf setting, which pushes the file with LF line endings, but keeps it checked out with CRLF line endings on Windows.

PigeonF avatar Sep 17 '25 07:09 PigeonF