add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR"

Use the new "git var GIT_EDITOR" feature to decide what editor to
use, instead of duplicating its logic elsewhere.  This should make
the behavior of commands in edge cases (e.g., editor names with
spaces) a little more consistent.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Nieder
2009-10-30 20:42:34 -05:00
committed by Junio C Hamano
parent 6361824589
commit b4479f0747
8 changed files with 16 additions and 29 deletions

View File

@ -987,8 +987,7 @@ sub edit_hunk_manually {
EOF
close $fh;
my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor")
|| $ENV{VISUAL} || $ENV{EDITOR} || "vi";
chomp(my $editor = run_cmd_pipe(qw(git var GIT_EDITOR)));
system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
if ($? != 0) {