Re: is it kosher for pre-commit to change what's staged?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:
> Joey Hess <joey@xxxxxxxxxxx> 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. :)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]