git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] do not open editor in dumb terminal

From
AWAmos Waterland <apw@us.ibm.com>
Date
Feb 3, 2006, 11:41 UTC
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 <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
Next: Junio C Hamano
Message 1 of 9 in “do not open editor in dumb terminal”
  1. do not open editor in dumb terminalAmos Waterland, Feb 3, 2006
  2. Junio C HamanoFeb 3, 2006
  3. Amos WaterlandFeb 5, 2006
  4. H. Peter AnvinFeb 5, 2006
  5. Junio C HamanoFeb 5, 2006
  6. Daniel BarkalowFeb 5, 2006
  7. Junio C HamanoFeb 5, 2006
  8. Petr BaudisFeb 5, 2006
  9. Junio C HamanoFeb 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.