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

Re: Is there a specific reason that git gui does not respect comment lines added by a git hook?

From
David Aguilar <davvid@gmail.com>
Date
Jan 29, 2011, 22:45 UTC
Message-ID
<20110129224528.GA7676@gmail.com>
In-Reply-To
<AANLkTingTLM8MCEBdS_4OAE5DU1L4xndRzQMq_gdvKaL@mail.gmail.com>
On Wed, Jan 26, 2011 at 11:14:28AM +0100, Wilbert van Dolleweerd wrote:
Show 7 quoted lines
> Hello,
> 
> I've written a prepare-commit-msg hook [...snip...]
> I'm using comments in the commit message to give additional
> information to the user. For example, when the Team Foundation Server
> is not available, I add the following comment to the top of the commit
> message.

I have the impression that you're running into this behavior because this information is at the top of the commit message (line 1). Users then fill in the actual message on the lines below this, I presume?

Try to see what happens if you set it up so that users fill in the commit message above the auto-generated comment. I have a feeling that it only strips out '#' lines after it's read in the commit message proper.

I haven't read the code so I'm not certain of this, but it seems like that is what's going on. Also, "git gui" uses plumbing commands underneath the hood and does not actually call "git commit" directly. That might help explain this subtle difference in behavior.

Show 14 quoted lines
> Because the line starts with a # sign, it is not added to the actual
> commit message...when using git commit. If I use git gui, the above
> comment appears in the git gui interface but *is* actually added to
> the git commit message when committing.
> 
> Is there a specific reason that git gui is actually adding lines
> starting with a # sign? I was expecting it to ignore those lines.
> 
> -- 
> Kind regards,
> 
> Wilbert van Dolleweerd
> Blog: http://walkingthestack.wordpress.com/
> Twitter: http://www.twitter.com/wvandolleweerd
-- 
		David
Previous: Wilbert van Dolleweerd
Message 2 of 2 in “Is there a specific reason that git gui does not respect comment lines added by a git hook?”
  1. Wilbert van DolleweerdJan 26, 2011
  2. David AguilarJan 29, 2011

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.