[Numpy-discussion] whitespace in git repo

Darren Dale dsdale24@gmail....
Wed Oct 27 09:58:57 CDT 2010

On Wed, Oct 27, 2010 at 8:36 AM, Friedrich Romstedt
<friedrichromstedt@gmail.com> wrote:
> Hi Darren,
> 2010/10/19 Darren Dale <dsdale24@gmail.com>:
>> I have the following set in my ~/.gitconfig file:
>>    [apply]
>>        whitespace = fix
>>    [core]
>>        autocrlf = input
>> which is attempting to correct some changes in:
>> branding/icons/numpylogo.svg
>> branding/icons/numpylogoicon.svg
>> tools/win32build/nsis_scripts/numpy-superinstaller.nsi.in
> Here an excerpt from git-config:
> core.autocrlf
>    Setting this variable to "true" is almost the same as setting the
> text attribute to "auto" on all files except that text files are not
> guaranteed to be normalized: files that contain CRLF in the repository
> will not be touched. Use this setting if you want to have CRLF line
> endings in your working directory even though the repository does not
> have normalized line endings. This variable can be set to input, in
> which case no output conversion is performed.
> >From git-apply:
> ``fix`` outputs warnings for a few such errors, and applies the patch
> after fixing them (strip is a synonym --- the tool used to consider
> only trailing whitespace characters as errors, and the fix involved
> stripping them, but modern gits do more).
> So I think your "autocrlf=input" makes the .nsi.in file checked out as
> LF since it's in LF in the repo, and "no output conversion is
> performed" due to core.autocrlf=input in your .gitconfigure.
> So the svg changes must come from the 'fix' value for the whitespace action.
> I don't think it is a good idea to let whitespace be fixed by git and
> not by your editor :-)  Or do you disagree?

"What are considered whitespace errors is controlled by
core.whitespace configuration. By default, trailing whitespaces
(including lines that solely consist of whitespaces) and a space
character that is immediately followed by a tab character inside the
initial indent of the line are considered whitespace errors."

No mention of EOL conversions there. But yes, I guess we disagree. I
prefer to have git automatically strip any trailing whitespace that I
might have accidentally introduced.

> This whitespace & newline thing is really painful, I suggest you set
> in your .gitconfig:
> [core]
>    autocrlf = true

I don't think so: "Use this setting if you want to have CRLF line
endings in your working directory even though the repository does not
have normalized line endings." I don't want CRLF in my working
directory. Did you read
http://help.github.com/dealing-with-lineendings/ ?

> and in our numpy .gitattributes:
> * text=auto

That is already included in the pull request.

> while the text=auto is more strong and a superset of autocrlf=true.
> I came across this when trying if text=auto marks any files as
> changed, and it didn't so everything IS already LF in the repo.
> Can you check this please?

Check what?

> I was near to leaving a comment like
> "asap" on github, but since this is so horribly complicated and
> error-prone ...

I'm starting to consider canceling the pull request.


More information about the NumPy-Discussion mailing list