[PATCH] do not open editor in dumb terminal

From: Amos Waterland <apw@us.ibm.com>
Date: 2006-02-03 22:41:33
Many people run git from a shell in emacs (obtained by M-x shell).  When
they try to do a commit without specifying a log message on the command
line with -m, git opens vi inside emacs, with unpleasant results.  I
think the right answer is to just refuse to open an editor in any dumb
terminal.

Signed-off-by: Amos Waterland <apw@us.ibm.com>
Cc: Dave C Boutcher <boutcher@cs.umn.edu>

---

 git-commit.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

c0ee93460521c1cbf9d3fe86a08b41295a79ebb1
diff --git a/git-commit.sh b/git-commit.sh
index 193feeb..fef8f96 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -207,6 +207,12 @@ then
 fi
 case "$no_edit" in
 '')
+	if [ "$TERM" = "dumb" ]; then
+		printf "%s: %s: %s\n" "git-commit" \
+			"cannot open editor in a dumb terminal" \
+			"use -m to supply message" >&2
+		exit 1
+	fi
 	${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG"
 	;;
 esac
-- 
1.1.6.g46dc-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Feb 03 22:42:11 2006

This archive was generated by hypermail 2.1.8 : 2006-02-03 22:42:21 EST