git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-commit: add a prepare-commit-msg hook
@ 2008-01-21 14:27 Paolo Bonzini
  2008-01-21 14:02 ` [PATCH 1/4] git-commit: support variable number of hook arguments Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Paolo Bonzini @ 2008-01-21 14:27 UTC (permalink / raw)
  To: git

This series of patches adds a prepare-commit-msg hook.
The prepare-commit-msg hook is run whenever a "fresh" commit message
is prepared, just before it is shown in the editor (if it is).
It can modify the commit message in-place and/or abort the commit.
I implemented Alex Riesen's suggestion to tell the hook where the
message came from, and now run the hook even if the editor is not
run.

Patches 1 and 2 are small changes.  Patch 1 changes run_hook to
accept a variable-length NULL-terminated list of arguments.  Patch 2
forces GIT_EDITOR to : if editor will not be launched; this is the
simplest way I found to tell the prepare-commit-msg hook whether
the editor will be launched.

Patch 3 is bigger; it refactors parts of git-commit to do all the
log message processing at the same time.  Currently the message
is prepared soon, but only edited after the first part of the commit
object is prepared.  This simplifies a little the code for part 4.

Part 4 actually adds the hook, including documentation and testcases.
The hook takes two parameters.  The first is the source of the commit
message (detailed more in the commit message and in the docs), which
is either an English word or a commit SHA1.  The second
parameter if the name of the file that the commit log message.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>

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

end of thread, other threads:[~2008-02-05  6:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 14:27 [PATCH] git-commit: add a prepare-commit-msg hook Paolo Bonzini
2008-01-21 14:02 ` [PATCH 1/4] git-commit: support variable number of hook arguments Paolo Bonzini
2008-02-04 16:43   ` Johannes Schindelin
2008-02-05  3:09     ` Junio C Hamano
2008-01-21 14:06 ` [PATCH 2/4] git-commit: set GIT_EDITOR=: if editor will not be launched Paolo Bonzini
2008-01-21 14:27 ` [PATCH 4/4] git-commit: add a prepare-commit-msg hook Paolo Bonzini
2008-02-05  3:08   ` Junio C Hamano
2008-01-21 14:33 ` [PATCH 3/4] git-commit: Refactor creation of log message Paolo Bonzini
2008-02-04 16:48   ` Johannes Schindelin
2008-02-04 17:14     ` Paolo Bonzini
2008-02-05  1:39       ` Junio C Hamano
2008-02-05  4:07         ` Junio C Hamano
2008-02-05  6:07           ` Paolo Bonzini

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