summaryrefslogtreecommitdiff
path: root/git-mergetool--lib.sh
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-11-24 00:29:17 +0100
committerJunio C Hamano <gitster@pobox.com>2009-11-23 15:38:04 -0800
commit7b1042292d5dc18508213c3be888b740d02f02e3 (patch)
tree4209eb7a0f58a34f8025d97c1d2ec6ed9c62c0f3 /git-mergetool--lib.sh
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-7b1042292d5dc18508213c3be888b740d02f02e3.tar.gz
mergetool--lib: simplify guess_merge_tool()
Use a case statement instead of calling grep to find out if the editor's name contains the string "vim". Remove the check for emacs, as this branch did the same as the default one anyway. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r--git-mergetool--lib.sh13
1 files changed, 6 insertions, 7 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index bfb01f7842..334af7c347 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -325,15 +325,14 @@ guess_merge_tool () {
fi
tools="$tools gvimdiff diffuse ecmerge araxis"
fi
- if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
- # $EDITOR is emacs so add emerge as a candidate
- tools="$tools emerge vimdiff"
- elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then
- # $EDITOR is vim so add vimdiff as a candidate
+ case "${VISUAL:-$EDITOR}" in
+ *vim*)
tools="$tools vimdiff emerge"
- else
+ ;;
+ *)
tools="$tools emerge vimdiff"
- fi
+ ;;
+ esac
echo >&2 "merge tool candidates: $tools"
# Loop over each candidate and stop when a valid merge tool is found.