From: Adam Roben <aroben@apple.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Adam Roben <aroben@apple.com>
Subject: [PATCH] Add commit.editor configuration variable
Date: Wed, 18 Jul 2007 22:39:48 -0700 [thread overview]
Message-ID: <11848235881723-git-send-email-aroben@apple.com> (raw)
This variable lets you specify a different editor for editing commit messages.
If commit.editor is not set, git-commit falls back to VISUAL, then EDITOR as
before.
Signed-off-by: Adam Roben <aroben@apple.com>
---
Documentation/git-commit.txt | 9 +++++----
git-commit.sh | 13 +++++++------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index f96142f..1a628be 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -244,10 +244,11 @@ on the Subject: line and the rest of the commit in the body.
include::i18n.txt[]
-ENVIRONMENT VARIABLES
----------------------
-The command specified by either the VISUAL or EDITOR environment
-variables is used to edit the commit log message.
+ENVIRONMENT AND CONFIGURATION VARIABLES
+---------------------------------------
+The editor used to edit the commit log message will be chosen from the
+commit.editor configuration variable, the VISUAL environment variable, or the
+EDITOR environment variable (in that order).
HOOKS
-----
diff --git a/git-commit.sh b/git-commit.sh
index 3f3de17..c4d8501 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -544,18 +544,19 @@ fi
case "$no_edit" in
'')
- case "${VISUAL:-$EDITOR},$TERM" in
+ commit_editor=$(git config commit.editor || echo ${VISUAL:-$EDITOR})
+ case "$commit_editor,$TERM" in
,dumb)
- echo >&2 "Terminal is dumb but no VISUAL nor EDITOR defined."
- echo >&2 "Please supply the commit log message using either"
- echo >&2 "-m or -F option. A boilerplate log message has"
- echo >&2 "been prepared in $GIT_DIR/COMMIT_EDITMSG"
+ echo >&2 "Terminal is dumb but commit.editor, VISUAL, and EDITOR"
+ echo >&2 "are undefined. Please supply the commit log message"
+ echo >&2 "using either -m or -F option. A boilerplate log message"
+ echo >&2 "has been prepared in $GIT_DIR/COMMIT_EDITMSG"
exit 1
;;
esac
git-var GIT_AUTHOR_IDENT > /dev/null || die
git-var GIT_COMMITTER_IDENT > /dev/null || die
- ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG"
+ ${commit_editor:-vi} "$GIT_DIR/COMMIT_EDITMSG"
;;
esac
--
1.5.2.2.620.g42358-dirty
next reply other threads:[~2007-07-19 5:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-19 5:39 Adam Roben [this message]
2007-07-19 6:08 ` [PATCH] Add commit.editor configuration variable Junio C Hamano
2007-07-19 6:17 ` Adam Roben
2007-07-19 6:23 ` Shawn O. Pearce
2007-07-19 6:53 ` Junio C Hamano
2007-07-19 9:54 ` Johannes Schindelin
2007-07-19 18:24 ` [PATCH] Add git-sh-setup::set_editor() Adam Roben
2007-07-19 18:46 ` Johannes Schindelin
2007-07-19 19:26 ` David Kastrup
2007-07-19 21:10 ` [PATCH] Print an error when falling back to vi on a dumb terminal Adam Roben
2007-07-19 21:19 ` Johannes Schindelin
2007-07-20 0:15 ` Junio C Hamano
2007-07-20 0:28 ` [PATCH] Add core.editor configuration variable Adam Roben
2007-07-20 5:09 ` [PATCH] Add GIT_EDITOR environment variable and " Adam Roben
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11848235881723-git-send-email-aroben@apple.com \
--to=aroben@apple.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).