mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
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>
This commit is contained in:
parent
78d553b7d7
commit
7b1042292d
|
@ -325,15 +325,14 @@ guess_merge_tool () {
|
||||||
fi
|
fi
|
||||||
tools="$tools gvimdiff diffuse ecmerge araxis"
|
tools="$tools gvimdiff diffuse ecmerge araxis"
|
||||||
fi
|
fi
|
||||||
if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
|
case "${VISUAL:-$EDITOR}" in
|
||||||
# $EDITOR is emacs so add emerge as a candidate
|
*vim*)
|
||||||
tools="$tools emerge vimdiff"
|
|
||||||
elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then
|
|
||||||
# $EDITOR is vim so add vimdiff as a candidate
|
|
||||||
tools="$tools vimdiff emerge"
|
tools="$tools vimdiff emerge"
|
||||||
else
|
;;
|
||||||
|
*)
|
||||||
tools="$tools emerge vimdiff"
|
tools="$tools emerge vimdiff"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
echo >&2 "merge tool candidates: $tools"
|
echo >&2 "merge tool candidates: $tools"
|
||||||
|
|
||||||
# Loop over each candidate and stop when a valid merge tool is found.
|
# Loop over each candidate and stop when a valid merge tool is found.
|
||||||
|
|
Loading…
Reference in a new issue