# Re: [PATCH] git-commit: filter out log message lines only when editor was run.

3 messages from 2006-06-24 to 2006-06-25. Participants: Yann Dirson, Marco Costalba.
Thread: https://gitlist.dev/t/4657

## Yann Dirson, 2006-06-24 09:42

Subject: Re: [PATCH] git-commit: filter out log message lines only when editor was run.
Message-ID: <20060624094217.GB7851@nowhere.earth>
URL: https://gitlist.dev/e/20060624094217.GB7851%40nowhere.earth

```
Junio wrote:
> I agree with this in principle but we would need to make sure
> that our own scripts do not expect that the message is cleaned
> up when feeding a commit log message via stdin, -m or -F, and if
> they do fix them before applying this patch.

The only tools in git.git I could identify as using git-commit rather
than commit-tree are:

git-revert.sh: OK
git-rebase.sh: only uses -C

cogito, stgit, and pg also use commit-tree.  Only qgit seems to be
using git-commit, and probably makes use of this (mis)feature.

I guess the easiest way to get the 1.4.0 behaviour is to change
git-commit calls to "git-commit -e" with EDITOR=true in the
environment.  I'm not sure it would be worth adding a new flag to
switch on/off log stripping.

Best regards,
-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

```

## Marco Costalba, 2006-06-25 07:08

Subject: Re: [PATCH] git-commit: filter out log message lines only when editor was run.
Message-ID: <e5bfff550606250008k702acfadm8860e9b672bced56@mail.gmail.com>
URL: https://gitlist.dev/e/e5bfff550606250008k702acfadm8860e9b672bced56%40mail.gmail.com
In-Reply-To: <20060624094217.GB7851@nowhere.earth>

```
On 6/24/06, Yann Dirson <ydirson@altern.org> wrote:
> Junio wrote:
> > I agree with this in principle but we would need to make sure
> > that our own scripts do not expect that the message is cleaned
> > up when feeding a commit log message via stdin, -m or -F, and if
> > they do fix them before applying this patch.
>
> The only tools in git.git I could identify as using git-commit rather
> than commit-tree are:
>
> git-revert.sh: OK
> git-rebase.sh: only uses -C
>
> cogito, stgit, and pg also use commit-tree.  Only qgit seems to be
> using git-commit, and probably makes use of this (mis)feature.
>

Yes, qgit uses git-commit, but issue is different.

qgit uses the output of git status as a 'default text' used in the
commit dialog. When commit button is pressed, after some message
editing by the user,  the comment lines are stripped _before_ to save
the content of commit message in a temporary file to be used by
git-commit with -F option.

The comment stripping is done by this code:

	msg = textEditMsg->text();
	msg.remove(QRegExp("\\n\\s*#[^\\n]*")); // strip comments
	msg.replace(QRegExp("[ \\t\\r\\f\\v]+\\n"), "\n"); // strip line trailing cruft
	msg = msg.stripWhiteSpace();

as you see it rely on the  '#' character.

So conclusions are:

1) It's ok to let git-comit do not strip comment lines, it's already
done by qgit.

2) Please don't change git status output to use another symbol to mark
comment lines because it will break line stripping code.

        Marco

```

## Yann Dirson, 2006-06-25 07:21

Subject: Re: [PATCH] git-commit: filter out log message lines only when editor was run.
Message-ID: <20060625072100.GG1502@nowhere.earth>
URL: https://gitlist.dev/e/20060625072100.GG1502%40nowhere.earth
In-Reply-To: <e5bfff550606250008k702acfadm8860e9b672bced56@mail.gmail.com>

```
On Sun, Jun 25, 2006 at 09:08:02AM +0200, Marco Costalba wrote:
> 1) It's ok to let git-comit do not strip comment lines, it's already
> done by qgit.

That's great news :)

> 2) Please don't change git status output to use another symbol to mark
> comment lines because it will break line stripping code.

If it ever gets changed, it should anyway IMHO be made a parameter.  A
strategy could be to make it customizable first, advertize this loudly
so tools adapt themselves to force the prefix to what suits them best,
and then eventually change the default in a major release.

Best regards,
-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

```
