From: Paolo Bonzini <bonzini@gnu.org>
To: git@vger.kernel.org
Subject: [PATCH-v2 2/4] git-commit: set GIT_EDITOR=: if editor will not be launched
Date: Tue, 5 Feb 2008 11:01:45 +0100 [thread overview]
Message-ID: <1202205704-10024-2-git-send-email-bonzini@gnu.org> (raw)
In-Reply-To: <1202205704-10024-1-git-send-email-bonzini@gnu.org>
This is a preparatory patch that provides a simple way for the future
prepare-commit-msg hook to discover if the editor will be launched.
---
Documentation/hooks.txt | 4 ++++
builtin-commit.c | 2 ++
2 files changed, 6 insertions(+), 0 deletions(-)
This has not changed.
diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt
index f110162..e8d80cf 100644
--- a/Documentation/hooks.txt
+++ b/Documentation/hooks.txt
@@ -61,6 +61,10 @@ The default 'pre-commit' hook, when enabled, catches introduction
of lines with trailing whitespaces and aborts the commit when
such a line is found.
+All the `git-commit` hooks are invoked with the environment
+variable `GIT_EDITOR=:` if the command will not bring up an editor
+to modify the commit message.
+
commit-msg
----------
diff --git a/builtin-commit.c b/builtin-commit.c
index 405c8b5..7d1059c 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -599,6 +599,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
use_editor = 0;
if (edit_flag)
use_editor = 1;
+ if (!use_editor)
+ setenv("GIT_EDITOR", ":", 1);
if (get_sha1("HEAD", head_sha1))
initial_commit = 1;
--
1.5.3.4.910.gc5122-dirty
next prev parent reply other threads:[~2008-02-05 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 10:01 [PATCH-v2 1/4] git-commit: support variable number of hook arguments Paolo Bonzini
2008-02-05 10:01 ` Paolo Bonzini [this message]
2008-02-05 10:01 ` [PATCH-v2 3/4] git-commit: Refactor creation of log message Paolo Bonzini
2008-02-05 10:01 ` [PATCH-v2 4/4] git-commit: add a prepare-commit-msg hook Paolo Bonzini
2008-02-05 15:01 ` Johannes Schindelin
2008-02-05 15:16 ` Paolo Bonzini
2008-02-05 15:21 ` Johannes Schindelin
2008-02-05 15:26 ` Paolo Bonzini
2008-02-05 20:02 ` Junio C Hamano
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=1202205704-10024-2-git-send-email-bonzini@gnu.org \
--to=bonzini@gnu.org \
--cc=git@vger.kernel.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).