summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3473f30)
raw | patch | inline | side by side (parent: 3473f30)
author | Paolo Bonzini <bonzini@gnu.org> | |
Tue, 5 Feb 2008 10:01:45 +0000 (11:01 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 6 Feb 2008 10:26:02 +0000 (02:26 -0800) |
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.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
prepare-commit-msg hook to discover if the editor will be launched.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/hooks.txt | patch | blob | history | |
builtin-commit.c | patch | blob | history |
index f110162b0155b3b17bc3133c5f42504290c1de4d..e8d80cfcdba2799e5f553f6bc004aa72b71a9f25 100644 (file)
--- a/Documentation/hooks.txt
+++ b/Documentation/hooks.txt
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 ec00134f9842ac8ddba72d3f8489036a9f21a396..90ddbaebf85b0d3593b61d4274caf4946a3b710b 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
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;