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

Re: git commit -C vs. prepare-commit-msg hook

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Nov 2, 2010, 23:01 UTC
Message-ID
<20101102230112.GC2116@neumann>
In-Reply-To
<AANLkTimdjAc1ZKNkWAO_KU8CqorShMv0TNDvsy5qmSDw@mail.gmail.com>
Hi Pat,
Thanks for your reply.
On Tue, Nov 02, 2010 at 02:11:33PM -0600, Pat Notz wrote:
Show 12 quoted lines
> 2010/11/2 SZEDER Gábor <szeder@ira.uka.de>:
> > Hi,
> >
> > Just noticed (read: got bitten by ;) that 'git commit' runs the
> > prepare-commit-msg hook even if it was invoked with the -C option.
> > This seems contradictory to me, because 'git commit -C' is to reuse an
> > already existing log message (and author info) as is, whereas
> > prepare-commit-msg is there to automatically edit the commit message.
> >
> 
> Can your hook look for the presence of the third command line argument
> to catch this case?
Yeah, this is what I tried as workaround ...
> Granted, you won't be able to tell the difference between -C and -c
> or --amend.

... and this is why it didn't work out, i.e. I needed to differentiate -C from -c or --amend.

> > Is this desired and I'm missing something, or is this a bug?  (or just
> > accidental, but we can't do anything about it anyway because of
> > backward compatibility?)
Previous: Pat Notz
Message 3 of 3 in “git commit -C vs. prepare-commit-msg hook”
  1. SZEDER GáborNov 2, 2010
  2. Pat NotzNov 2, 2010
  3. SZEDER GáborNov 2, 2010

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.