From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Joey Hess <joey@kitenet.net>, git@vger.kernel.org
Subject: Re: is it kosher for pre-commit to change what's staged?
Date: Wed, 10 Nov 2010 14:06:50 -0600 [thread overview]
Message-ID: <20101110200650.GA13439@burratino> (raw)
In-Reply-To: <7v1v6thrzc.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Joey Hess <joey@kitenet.net> writes:
>> I've noticed that if I make a pre-commit hook change the files that are
>> staged, those changes are not reflected in the commit message. For
>> example, if a pre-commit hook git add's somefile, the commit message
>> won't reflect that. I guess prepare-commit-msg is being run before
>> pre-commit for some reason?
I'm guessing it is to allow cancelling a commit before a costly
pre-commit hook runs.
> My intention was that Documentation/githooks.txt would document things
> that are allowed (e.g. "applypatch-msg" explicitly says "The hook is
> allowed to edit the message"), and anything that is not specifically
> allowed is not.
>
> "Is it kosher" is a difficult question to answer, as something may not be
> allowed but there may not be an enforcement mechanism to deny it, iow, it
> may happen to work by accident.
In this case, isn't it only a half accident? For example, I think
v1.5.4-rc0~78^2~12 (builtin-commit: fix partial-commit support,
2007-11-18) taught git to support this a little better.
That said, I would be interested to hear the use case, since modifying
staged content on the fly for a commit sounds a little crazy. :)
next prev parent reply other threads:[~2010-11-10 20:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 17:08 is it kosher for pre-commit to change what's staged? Joey Hess
2010-11-10 19:57 ` Junio C Hamano
2010-11-10 20:06 ` Jonathan Nieder [this message]
2010-11-10 20:45 ` Joey Hess
2010-11-10 22:17 ` Dmitry Potapov
2010-11-11 19:26 ` Jan Hudec
2010-11-11 20:46 ` Joey Hess
2010-11-11 22:03 ` Junio C Hamano
2010-11-11 22:06 ` Kevin Ballard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101110200650.GA13439@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=joey@kitenet.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).