[Numpy-discussion] whitespace in git repo

Darren Dale dsdale24@gmail....
Thu Oct 28 10:23:53 CDT 2010


Hi Chuck,

On Wed, Oct 27, 2010 at 1:30 PM, Charles R Harris
<charlesr.harris@gmail.com> wrote:
>
> I'd like to do something here, but I'm waiting for a consensus and for
> someone to test things out, maybe with a test repo, to make sure things
> operate correctly. The documentation isn't that clear...

I am getting ready to test on windows and mac. In the process of
upgrading git on windows to 1.7.3.1, The following dialog appeared:

Configuring line ending conversions
  How should Git treat line endings in text files?

x Checkout Windows-style, commit Unix-style line endings
  Git will convert LF to CRLF when checking out text files. When
committing text files, CRLF will be converted to LF. For
cross-platform projects, this is the recommended setting on Windows
("core.autocrlf" is set to "true")

o Checkout as-is, commit Unix-style line endings
  Git will not perform any conversion when checking out text files.
When committing text files, CRLF will be converted to LF. For
cross-platform projects this is the recommended setting on Unix
("core.autocrlf" is set to "input").

o Checkout as-is, commit as-is
  Git will not perform any conversions when checking out or committing
text files. Choosing this option is not recommended for cross-platform
projects ("core.autocrlf" is set to "false")

This might warrant a very brief mention in the docs, for helping
people set up their environment. Its too bad core.autocrlf cannot be
set on a per-project basis in a file that gets committed to the
repository. As far as I can tell, it can only be set in ~/.gitconfig
or numpy/.git/config. Which is why I suggested adding .gitattributes,
which can be committed to the repository, and the line "* text=auto"
ensures that EOLs in text files are committed as LF, so we don't have
to worry about somebody's config settings having unwanted impact on
the repository.

And now the bad news: I have not been able to verify that Git respects
the autocrlf setting or the eol setting in .gitattributes on my
windows 7 computer: I made a new clone and the line endings are LF in
the working directory, both on master and in my whitespace-cleanup
branch (even the nsi.in file!). ("git config -l" confirms that
"core.autocrlf" is "true".) To check my sanity, I tried writing files
using wordpad and notepad to confirm that they are at least using
CRLF, and they are *not*, according to both python's open() and grep
"\r\n". If it were after noon where I live, I would be looking for a
bottle of whiskey. But its not, so I'll just beat my head against my
desk until I've forgotten about this whole episode.


More information about the NumPy-Discussion mailing list