git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Jun 25, 2006, 07:08 UTC
Message-ID
<e5bfff550606250008k702acfadm8860e9b672bced56@mail.gmail.com>
In-Reply-To
<20060624094217.GB7851@nowhere.earth>
On 6/24/06, Yann Dirson <ydirson@altern.org> wrote:
Show 15 quoted lines
> 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
Previous: Yann DirsonNext: Yann Dirson
Message 2 of 3 in “Re: [PATCH] git-commit: filter out log message lines only when editor was run.”
  1. Yann DirsonJun 24, 2006
  2. Marco CostalbaJun 25, 2006
  3. Yann DirsonJun 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.