git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* No auto CRLF conversion in Commit Message comments
@ 2015-12-16 15:13 Harfoot A.J.
  2015-12-16 16:45 ` Johannes Schindelin
  0 siblings, 1 reply; 3+ messages in thread
From: Harfoot A.J. @ 2015-12-16 15:13 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi there,

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.
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

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!

Is there a way to fix this inconsistency?

Cheers,

Andy

-- 

Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel:  +44 (0)23 8059 2719
Fax:  +44 (0)23 8059 2849

www.geodata.soton.ac.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: No auto CRLF conversion in Commit Message comments
  2015-12-16 15:13 No auto CRLF conversion in Commit Message comments Harfoot A.J.
@ 2015-12-16 16:45 ` Johannes Schindelin
  2015-12-17 11:58   ` Andrew Harfoot
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2015-12-16 16:45 UTC (permalink / raw)
  To: Harfoot A.J.; +Cc: git@vger.kernel.org

Hi A.J.,

On Wed, 16 Dec 2015, Harfoot A.J. wrote:

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: No auto CRLF conversion in Commit Message comments
  2015-12-16 16:45 ` Johannes Schindelin
@ 2015-12-17 11:58   ` Andrew Harfoot
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Harfoot @ 2015-12-17 11:58 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git@vger.kernel.org

Hi Johannes,

On 16/12/2015 16:45, Johannes Schindelin wrote:
> 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.

The problem in my case was that I had

`core.editor = notepad.exe`

This wasn't triggering the helper, I've changed it, dropping the '.exe' 
and it now works nicely.

Thanks for your help,

Andy

-- 
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel:  +44 (0)23 8059 2719
Fax:  +44 (0)23 8059 2849

www.geodata.soton.ac.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-17 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 15:13 No auto CRLF conversion in Commit Message comments Harfoot A.J.
2015-12-16 16:45 ` Johannes Schindelin
2015-12-17 11:58   ` Andrew Harfoot

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).