@matheusbsbs / matheus-bagliano / commits / 406400ce4f
Fork 0

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>

Paolo Bonzini committed Feb 5, 2008 at 11:01 UTC 406400ce4f69e79b544dd3539a71b85d99331820
2 files changed +6
Documentation/hooks.txt
+4
@@ -61,6 +61,10 @@ The default 'pre-commit' hook, when enabled, catches introduction
61 of lines with trailing whitespaces and aborts the commit when
62 such a line is found.
63
64 +All the `git-commit` hooks are invoked with the environment
65 +variable `GIT_EDITOR=:` if the command will not bring up an editor
66 +to modify the commit message.
67 +
68 commit-msg
69 ----------
70
builtin-commit.c
+2
@@ -599,6 +599,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
599 use_editor = 0;
600 if (edit_flag)
601 use_editor = 1;
602 + if (!use_editor)
603 + setenv("GIT_EDITOR", ":", 1);
604
605 if (get_sha1("HEAD", head_sha1))
606 initial_commit = 1;