emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Git refuses to commit files with DOS EOL


From: Paul Eggert
Subject: Re: Git refuses to commit files with DOS EOL
Date: Sat, 30 May 2015 09:35:49 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Eli Zaretskii wrote:
The pre-commit hook complains about trailing whitespace in such
files.  I needed to use --no-verify to get past it.

Why is it doing that?

Git keeps track of text files with CRLF vs LF endings, and autoconverts from one format to another when it is run on platforms that prefer one or the other. It also knows about binary formats, where there's no conversion. It needs to do all this stuff in order for merging to work reliably, since merging often works on a line-by-line basis.

To get this all to work, you sometimes have to tell Git about files that don't follow the ordinary rules: e.g., they are text files that should use CRLF endings even on GNUish and POSIX platforms. This is done in the .gitattributes file. There's a man page for .gitattributes, as well as one for the 'git check-attr' command. The actual set of features is more complicated than what I've mentioned here, and the GNU Emacs .gitattributes file doesn't use all the features.

I patched .gitattributes to mention the CRLF-oriented files you recently added to the test cases.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]