From: Mark Levedahl <mlevedahl@gmail.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH 2/2] git-gui - provide commit-type to the hooks/pre-commit script
Date: Sat, 5 Jun 2010 13:43:20 -0400 [thread overview]
Message-ID: <1275759800-16577-1-git-send-email-mlevedahl@gmail.com> (raw)
In-Reply-To: <1275759590-16342-1-git-send-email-mlevedahl@gmail.com>
If hooks/pre-commit acts based upon the changes to be checked in
rather than just the resulting content, the script needs to know which
commit to use. For a normal commit, this is HEAD, but when amending this
is HEAD~1. So, this modifies commit.c to pass $1 as normal|amend depending
upon the commit type. Existing scripts are unaffected as they did not
expect any argument so will silently ignore this extra bit of info.
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
git-gui/lib/commit.tcl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index 7f459cd..8150fa6 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -225,7 +225,7 @@ A good commit message has the following format:
# -- Run the pre-commit hook.
#
- set fd_ph [githook_read pre-commit]
+ set fd_ph [githook_read pre-commit $commit_type]
if {$fd_ph eq {}} {
commit_commitmsg $curHEAD $msg_p
return
--
1.7.1.270.g2a29a
next prev parent reply other threads:[~2010-06-05 17:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-05 17:39 [PATCH 1/2] commit.c - provide commit-type to the hooks/pre-commit script Mark Levedahl
2010-06-05 17:43 ` Mark Levedahl [this message]
2010-06-06 22:10 ` Jeff King
2010-06-07 0:21 ` Mark Levedahl
2010-06-07 6:26 ` Johannes Sixt
2010-06-07 6:38 ` Jeff King
2010-06-08 2:55 ` Mark Levedahl
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=1275759800-16577-1-git-send-email-mlevedahl@gmail.com \
--to=mlevedahl@gmail.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/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).