git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Joey Hess <joey@kitenet.net>
Cc: git@vger.kernel.org
Subject: Re: is it kosher for pre-commit to change what's staged?
Date: Wed, 10 Nov 2010 11:57:11 -0800	[thread overview]
Message-ID: <7v1v6thrzc.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20101110170819.GA3031@gnu.kitenet.net> (Joey Hess's message of "Wed\, 10 Nov 2010 13\:08\:19 -0400")

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?

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 general, pre-anything is about checking and denying and is supposed to
be free of side effects.

  reply	other threads:[~2010-11-10 19:57 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 [this message]
2010-11-10 20:06   ` Jonathan Nieder
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=7v1v6thrzc.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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).