FUNCTIONS
---------
get_merge_tool::
- returns a merge tool.
+ returns a merge tool. the return code is 1 if we returned a guessed
+ merge tool, else 0. '$GIT_MERGETOOL_GUI' may be set to 'true' to
+ search for the appropriate guitool.
get_merge_tool_cmd::
returns the custom command for a merge tool.
then
merge_tool="$GIT_DIFF_TOOL"
else
- merge_tool="$(get_merge_tool)" || exit
+ merge_tool="$(get_merge_tool)"
fi
fi
}
get_merge_tool () {
+ is_guessed=false
# Check if a merge tool has been configured
- merge_tool=$(get_configured_merge_tool)
+ merge_tool=$(get_configured_merge_tool $GIT_MERGETOOL_GUI)
# Try to guess an appropriate merge tool if no tool has been set.
if test -z "$merge_tool"
then
merge_tool=$(guess_merge_tool) || exit
+ is_guessed=true
fi
echo "$merge_tool"
+ test "$is_guessed" = false
}
mergetool_find_win32_cmd () {
main () {
prompt=$(git config --bool mergetool.prompt)
- gui_tool=false
+ GIT_MERGETOOL_GUI=false
guessed_merge_tool=false
orderfile=
esac
;;
--no-gui)
- gui_tool=false
+ GIT_MERGETOOL_GUI=false
;;
-g|--gui)
- gui_tool=true
+ GIT_MERGETOOL_GUI=true
;;
-y|--no-prompt)
prompt=false
if test -z "$merge_tool"
then
- # Check if a merge tool has been configured
- merge_tool=$(get_configured_merge_tool $gui_tool)
- # Try to guess an appropriate merge tool if no tool has been set.
- if test -z "$merge_tool"
+ if ! merge_tool=$(get_merge_tool)
then
- merge_tool=$(guess_merge_tool) || exit
guessed_merge_tool=true
fi
fi