From: René Scharfe Date: Mon, 23 Nov 2009 23:29:17 +0000 (+0100) Subject: mergetool--lib: simplify guess_merge_tool() X-Git-Tag: v1.6.6-rc1~28^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7b1042292d5dc18508213c3be888b740d02f02e3;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index bfb01f784..334af7c34 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.