[LLVMdev] Fixing trailing whitespace

Michael Spencer bigcheesegs at gmail.com
Tue Oct 12 12:25:07 PDT 2010


I see a lot of commits fixing whitespace, my own included. Trailing
whitespace is very annoying and many of us have our editors setup to
remove it. This creates a problem when modifying other files that have
trailing whitespace on just about every empty line and comment. It
requires sifting through the diff and extracting the real changes.

Of course we could just disable trailing whitespace removal in our
editors, but trailing whitespace is just bad form. It can make it very
annoying to select or go to the end of a line. And it makes some of us
very anxious.

The fix is quite simple:

1) Install a pre-commit hook that rejects any changes that _add_ lines
with trailing whitespace or non-unix line endings.
2) Make one giant commit that removes all trailing whitespace from the repo.

This will not mess up blame because it's trivial to ignore whitespace changes.

svn blame -x-w
svn blame -x-b
git blame -w

- Michael Spencer



More information about the llvm-dev mailing list