All of lore.kernel.org
 help / color / mirror / Atom feed
* git commit -C vs. prepare-commit-msg hook
@ 2010-11-02 14:50 SZEDER Gábor
  2010-11-02 20:11 ` Pat Notz
  0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2010-11-02 14:50 UTC (permalink / raw)
  To: git

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.

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?)

Thanks.


Best,
Gábor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git commit -C vs. prepare-commit-msg hook
  2010-11-02 14:50 git commit -C vs. prepare-commit-msg hook SZEDER Gábor
@ 2010-11-02 20:11 ` Pat Notz
  2010-11-02 23:01   ` SZEDER Gábor
  0 siblings, 1 reply; 3+ messages in thread
From: Pat Notz @ 2010-11-02 20:11 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: git

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?  Granted, you won't be able to tell the difference
between -C and -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?)
>
> Thanks.
>
>
> Best,
> Gábor
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git commit -C vs. prepare-commit-msg hook
  2010-11-02 20:11 ` Pat Notz
@ 2010-11-02 23:01   ` SZEDER Gábor
  0 siblings, 0 replies; 3+ messages in thread
From: SZEDER Gábor @ 2010-11-02 23:01 UTC (permalink / raw)
  To: Pat Notz; +Cc: git

Hi Pat,


Thanks for your reply.

On Tue, Nov 02, 2010 at 02:11:33PM -0600, Pat Notz wrote:
> 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?)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-02 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 14:50 git commit -C vs. prepare-commit-msg hook SZEDER Gábor
2010-11-02 20:11 ` Pat Notz
2010-11-02 23:01   ` SZEDER Gábor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.