Page MenuHomePhabricator

Don't compare line endings when checking format
Needs ReviewPublic

Authored by michelm on Mar 9 2015, 9:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 27 2023, 8:35 PM
Unknown Object (File)
Feb 9 2023, 4:55 PM
Unknown Object (File)
Oct 10 2022, 9:03 PM
Unknown Object (File)
Aug 16 2022, 8:47 AM
Unknown Object (File)
Jul 26 2022, 11:37 AM
Unknown Object (File)
Jun 1 2022, 7:55 PM
Unknown Object (File)
Jan 17 2017, 10:56 PM
Unknown Object (File)
Nov 3 2016, 5:06 AM
Subscribers
None
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

By using readlines() when splitting the lines of code for formatted and
unformatted files, clang-format-diff.py reports lines that do not have
diffs as having diffs because the line endings in the original code
differs from the line endings generated by clang-format on Windows.
When we run with -i, it does not change the line endings, so if we run
without -i, clang-format-diff.py shows that there are still diffs. This
fix changes clang-format-diff.py to use read().split() which discards
line endings, fixing this problem.

Test Plan

Ran clang-format-diff.py on Windows to confirm that after fixing a line, clang-format-diff.py no longer see that line as having a diff.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 4824
Build 4840: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

michelm retitled this revision from to Don't compare line endings when checking format.
michelm updated this object.
michelm edited the test plan for this revision. (Show Details)