diff options
-rwxr-xr-x | scripts/git-hooks/commit-msg | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg index 7a1148949..559a0ea8f 100755 --- a/scripts/git-hooks/commit-msg +++ b/scripts/git-hooks/commit-msg @@ -6,7 +6,10 @@ use strict; use warnings; (my $ME = $0) =~ s|.*/||; -my $editor = $ENV{EDITOR} || 'vi'; +# Emulate Git's choice of the editor for the commit message. +chomp (my $editor = `git var GIT_EDITOR`); +# And have a sane, minimal fallback in case of weird failures. +$editor = "vi" if $? != 0 or $editor =~ /^\s*\z/; # Keywords allowed before the colon on the first line of a commit message: # program names and a few general category names. |