Re: No auto CRLF conversion in Commit Message comments
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 16, 2015, 16:45 UTC
- Message-ID
- <alpine.DEB.2.20.1512161738080.6483@virtualbox>
- In-Reply-To
- <FBEAE9E9FAB4174499E31C0F26B4BACD2DED2E66@SRV00048.soton.ac.uk>
Hi A.J.,
On Wed, 16 Dec 2015, Harfoot A.J. wrote:
Show 11 quoted lines
> I'm new to Git, so apologies if this is already available, but after > some searching and experimenting I haven't been able to resolve it. > > I am running Git 2.6.4.windows.1 on Windows 7 64 bit. > > I have the global configuration variable core.autocrlf=true > > When I commit, the commit message template file is loaded into my > configured text editor (in this case Windows Notepad), however the > comment lines are terminated with LF, not CRLF, and so are not displayed > as new lines by Notepad.
The core.autocrlf=true setting affects only Git's operation when it adds file contents to the index or writes files from the index.
However, if you have `core.editor = notepad`, it should Just Work because there is a `notepad` helper that performs the LF<->CR/LF translation transparently.
> In the opposite direction, the output of 'git log' redirected to a file > has all EOL characters set to LF, when originally entered as CRLF, so > automatic conversion is working
Somehow I doubt that `git log` transforms CR/LF to LF...
> I have tried to generate a custom commit message using the > commit.template variable, but the commented lines are appended to this > file, creating a mixture of EOL characters!
I am afraid that the only way to keep that consistent would be to ensure that your commit.template has the same line endings as your editor produces.
Ciao, Johannes