Page MenuHomePhabricator

Gerrit shows lots of apparently unchanged lines in the diff (due to line ending change from LF to CRLF)
Open, Needs TriagePublic

Description

In https://gerrit.wikimedia.org/r/c/mediawiki/libs/Equivset/+/604545 only a few lines have been added to the data/equivset.in file, but Gerrit shows every line of the file in its diff view (link).

I ran a git diff HEAD~1 on the change, and it looks like newline characters (^M as terminal calls them, \r in programming parlance) were added to the end of the lines, but I cannot find such character in the file itself. Even if they were added, the diff view of Gerrit is not being super helpful because it should at least show a red box (like it does for extra spaces or extra \n characters).

workaround

Set diff preference Ignore Whitespace to All to reduce the difference. Or locally use git show -w to ignore whitespaces.

Upstream https://bugs.chromium.org/p/gerrit/issues/detail?id=7996

Event Timeline

Huji created this task.Jun 30 2020, 1:59 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 30 2020, 1:59 AM
Aklapper renamed this task from Gerrit shows lots of apparently unchanged lines in the diff to Gerrit shows lots of apparently unchanged lines in the diff (due to line ending change from LF to CRLF).Jun 30 2020, 7:21 AM
hashar added a subscriber: hashar.

If you head to the diff at https://gerrit.wikimedia.org/r/c/mediawiki/libs/Equivset/+/604545/8/data/equivset.in you can change the preferences about how whitespaces are handled. I believe the default is to always take them in account hence why it is displayed as if everything got changed. The issue in Gerrit is that the windows CR + LF is not being shown, just as if one used git show.

To reduce the differences, one can use the cog icon () on the difference page and change Ignore Whitespace to All. That is the equivalent of git diff -w / git diff --ignore-all-space.

I guess this feature request is about displaying the extra CR being introduced, typically being displayed as Control + M or in short ^M.

The Upstream issue is https://bugs.chromium.org/p/gerrit/issues/detail?id=7996

hashar updated the task description. (Show Details)Jun 30 2020, 8:24 AM
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.Jul 3 2020, 12:29 PM