From: Amos Waterland Date: Fri, 03 Feb 2006 11:41:33 GMT Subject: [PATCH] do not open editor in dumb terminal Message-ID: <20060203114133.GA11499@kvasir.watson.ibm.com> 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 Cc: Dave C Boutcher --- 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