retitle 653968 [PATCH] gitolite: gl-setup doesn't warn it opens another editor (Emacs M-x shell) forwarded 653968 Sitaram Chamarty <sitar...@gmail.com> thanks
Sitaram, could you apply this patch to fix Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653968 Thanks, Jari
>From 60ec5448c5bac4f50d010b2ca3fd9b3f077ab65e Mon Sep 17 00:00:00 2001 From: Jari Aalto <jari.aa...@cante.net> Date: Tue, 10 Jan 2012 20:38:04 +0200 Subject: [PATCH] Try multiple editors for editing $GL_RC. Add Emacs check Organization: Private Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Signed-off-by: Jari Aalto <jari.aa...@cante.net> --- src/gl-setup | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gl-setup b/src/gl-setup index 3a6c04b..083743a 100755 --- a/src/gl-setup +++ b/src/gl-setup @@ -82,9 +82,25 @@ else if [ -z "$quiet" ] then printf "The default settings in the "rc" file ($GL_RC) are fine for most\n" - printf "people but if you wish to make any changes, you can do so now.\n\nhit enter..." + + if [ "$EMACS" ] && [ "$INSIDE_EMACS" ]; then + echo 'Aborted. gl-setup cannot be run under Emacs M-x shell. Would open $EDITOR' >&2 + exit 1 + fi + + printf "people but if you wish to make any changes, you can do so now.\n\n" + echo "hit enter to open file for editing in \$EDITOR..." read i - ${EDITOR:-vi} $GL_RC + + if [ "$EDITOR" ]; then + $EDITOR $GL_RC + elif [ -x /usr/bin/sensible-editor ]; then # Debian support + /usr/bin/sensible-editor $GL_RC + elif [ -x /usr/bin/nano ]; then + /usr/bin/nano $GL_RC + else + vi $GL_RC + fi fi fi -- 1.7.5.1