Thread (46 messages) flat view 46 messages, 6 authors, 2016-06-15
STALE3733d

Revision v2 of 3 in this series.

Revisions (3)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH 1/8] launch_editor: Longer error message when TERM=dumb

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:47:38
Subsystem: the rest · Maintainer: Linus Torvalds

Before falling back to vi, git checks if the terminal can support
such an editor by checking if $TERM is dumb.  git-sh-setup and
editor.c have similar but distinct error messages for this case.
To avoid changes in behavior when switching from one
implementation to the other, standardize on one error message.

Signed-off-by: Jonathan Nieder <redacted>
---
Probably this check should apply to $VISUAL, too, but that is a
separate topic.

I am not sure which is the better error message.  It looks like some
effort went into the longer message so I thought I should give it a
try, but I kind of prefer the shorter one.

 editor.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/editor.c b/editor.c
index 4d469d0..316d139 100644
--- a/editor.c
+++ b/editor.c
@@ -16,7 +16,13 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
 
 	terminal = getenv("TERM");
 	if (!editor && (!terminal || !strcmp(terminal, "dumb")))
-		return error("Terminal is dumb but no VISUAL nor EDITOR defined.");
+		/* Terminal is dumb but no VISUAL nor EDITOR defined. */
+		return error(
+		  "No editor specified in GIT_EDITOR, core.editor, VISUAL,\n"
+		  "or EDITOR. Tried to fall back to vi but terminal is dumb.\n"
+		  "Please set one of these variables to an appropriate\n"
+		  "editor or run again with options that will not cause an\n"
+		  "editor to be invoked (e.g., -m or -F for git commit).");
 
 	if (!editor)
 		editor = "vi";
-- 
1.6.5.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help