1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 12:59:41 +01:00

git-commit: set GIT_EDITOR=: if editor will not be launched

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>
This commit is contained in:
Paolo Bonzini 2008-02-05 11:01:45 +01:00 committed by Junio C Hamano
parent 3473f3035d
commit 406400ce4f
2 changed files with 6 additions and 0 deletions

View file

@ -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
----------

View file

@ -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;