git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Harfoot A.J." <A.J.P.Harfoot@soton.ac.uk>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: No auto CRLF conversion in Commit Message comments
Date: Wed, 16 Dec 2015 17:45:16 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1512161738080.6483@virtualbox> (raw)
In-Reply-To: <FBEAE9E9FAB4174499E31C0F26B4BACD2DED2E66@SRV00048.soton.ac.uk>

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

  reply	other threads:[~2015-12-16 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 15:13 No auto CRLF conversion in Commit Message comments Harfoot A.J.
2015-12-16 16:45 ` Johannes Schindelin [this message]
2015-12-17 11:58   ` Andrew Harfoot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1512161738080.6483@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=A.J.P.Harfoot@soton.ac.uk \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).