Skip to content

Commit

Permalink
mergetool--lib: simplify guess_merge_tool()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Nov 23, 2009
1 parent 78d553b commit 7b10422
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions git-mergetool--lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7b10422

Please sign in to comment.