summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/hooks.txt4
-rw-r--r--builtin-commit.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt
index f110162b01..e8d80cfcdb 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 ec00134f98..90ddbaebf8 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;