threads / discuss / 17164

question about COMMIT_EDITMSG crlf

Subject: question about COMMIT_EDITMSG crlf

## tl;dr

4 messages between Jan 14, 2009 and Jan 14, 2009.

replies: 3people: 4as markdown or json

Frank Li· Jan 14, 2009, 05:17 UTC · lore

I want to use notepad replace default vim at commit message editor. git commit will create COMMIT_EDITMSG at .git directory. This file is unix text mode. Is there any config change it to windows text mode?

Junio C Hamano· Jan 14, 2009, 07:04 UTC · re: Frank Li · lore

Re: question about COMMIT_EDITMSG crlf

"Frank Li" <lznuaa@gmail.com> writes:
> I want to use notepad replace default vim at commit message editor.
> git commit will create COMMIT_EDITMSG at .git directory. This file is
> unix text mode.
> Is there any config change it to windows text mode?

Nothing I can think of, other than using customized commit templates, which I suspect is a bit overkill and at the same time misses the point for this use case.

Johannes Sixt· Jan 14, 2009, 07:18 UTC · re: Frank Li · lore

Re: question about COMMIT_EDITMSG crlf

Frank Li schrieb:
> I want to use notepad replace default vim at commit message editor.
> git commit will create COMMIT_EDITMSG at .git directory. This file is
> unix text mode.
> Is there any config change it to windows text mode?

No, there isn't. But perhaps you can use WordPad instead of Notepad? There are reports that this worked.

You could also write a wrapper script that transforms the file before it calls Notepad on it (untested):

   #!/bin/bash
   sed -e $'s/\r?$/\r/' < "$1" > .git/tmp$$ &&
   mv .git/tmp$$ "$1" &&
   notepad "$1"

I think git commit removes the trailing CRs automatically, so they don't end up in the commit message.

-- Hannes
Juanma Barranquero· Jan 14, 2009, 09:01 UTC · re: Johannes Sixt · lore

Re: question about COMMIT_EDITMSG crlf

On Wed, Jan 14, 2009 at 08:18, Johannes Sixt <j.sixt@viscovery.net> wrote:
> No, there isn't. But perhaps you can use WordPad instead of Notepad? There
> are reports that this worked.
Or Notepad2:
http://www.flos-freeware.ch/notepad2.html
    Juanma

← back to recent threads