Skip to contentSkip to conversation

consistently try VISUAL, EDITOR and vi in this order.

RFC/PATCH Junio C Hamano 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

git grep -e VISUAL -e EDITOR revealed this inconsistency. All other commands seem to check VISUAL and then EDITOR as they should.

---

git-send-email.perl +1 -2
index c5d9e73..7b81962 100755
@@ -222,8 +256,7 @@ GIT: for the patch you are writing.
 EOT
 	close(C);
 
-	my $editor = $ENV{EDITOR};
-	$editor = 'vi' unless defined $editor;
+	my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
 	system($editor, $compose_filename);
 
 	open(C2,">",$compose_filename . ".final")
#1 lore raw
Quoted 6 lines · Junio C Hamano

git grep -e VISUAL -e EDITOR revealed this inconsistency. All other commands seem to check VISUAL and then EDITOR as they should.

+     my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
      system($editor, $compose_filename);

Shouldn't we check if we are in visual (non CLI-only) environment, like X-Window, MS Windows or MacOS X, before trying to use VISUAL? How other parts solve it? </me checks> Ah, we use VISUAL unconditionally, at least in scripts...

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git