[cairo] War on trailing whitespace

Carl Worth cworth at cworth.org
Tue Jun 6 16:35:50 PDT 2006


Trailing whitespace has no place in our software, but has a tendency
to sneak its way in and can cause some real annoyances.

Fortunately, git provides a nice, (but inactive by default), mechanism
for avoiding the introduction of trailing whitespace. I'm asking all
cairo developers to enable the default pre-commit hook which will
complain about trailing whitespace. The way to do this is to simply
run:

        chmod a+x .git/hooks/pre-commit

from your cairo clone.

I've also push out several commits that remove trailing whitespace
from the implementation.

It's possible that the change I just made will trigger some of the
trailing-whitespace annoyances for people that have large outstanding
patches to cairo. For example, it might cause a bunch of very
uninteresting conflicts. If anyone runs into problems like this, the
easiest thing to do is probably to first use git-stripspace, (it acts
as a filter), to fix up source files at interesting points in their
tree, and then regenerate patches from there.

I've added the following paragraphs to the CODING_STYLE document to
advise on the issues of trailing whitespace, (as well as gratuitous
blank lines at the beginning or end of files or duplicate blank lines
within files):

	Do eliminate trailing whitespace (space or tab characters) on any
	line. Also, avoid putting initial or final blank lines into any file,
	and never use multiple blank lines instead of a single blank line.

	Do enable the default git pre-commit hook that detect trailing
	whitespace for you and help you to avoid corrupting cairo's tree with
	it. Do that as follows:

	        chmod a+x .git/hooks/pre-commit

	You might also find the git-stripspace utility helpful which acts as a
	filter to remove trailing whitespace as well as initial, final, and
	duplicate blank lines.

Thanks for your attention to detail,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060606/8e3d24f5/attachment.pgp


More information about the cairo mailing list