mergetool--lib: create gui_mode function
Before, in `get_configured_merge_tool`, we would test the value of the first argument directly, which corresponded to whether we were using guitool. However, since `$GIT_MERGETOOL_GUI` is available as an environment variable, create the `gui_mode` function which increases the clarify of functions which use it. While we're at it, add a space before `()` in function definitions to fix the style. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
05fb8726cc
commit
884630b2e2
|
@ -80,14 +80,18 @@ show_tool_names () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diff_mode() {
|
diff_mode () {
|
||||||
test "$TOOL_MODE" = diff
|
test "$TOOL_MODE" = diff
|
||||||
}
|
}
|
||||||
|
|
||||||
merge_mode() {
|
merge_mode () {
|
||||||
test "$TOOL_MODE" = merge
|
test "$TOOL_MODE" = merge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_mode () {
|
||||||
|
test "$GIT_MERGETOOL_GUI" = true
|
||||||
|
}
|
||||||
|
|
||||||
translate_merge_tool_path () {
|
translate_merge_tool_path () {
|
||||||
echo "$1"
|
echo "$1"
|
||||||
}
|
}
|
||||||
|
@ -350,8 +354,7 @@ guess_merge_tool () {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_configured_merge_tool () {
|
get_configured_merge_tool () {
|
||||||
# If first argument is true, find the guitool instead
|
if gui_mode
|
||||||
if test "$1" = true
|
|
||||||
then
|
then
|
||||||
gui_prefix=gui
|
gui_prefix=gui
|
||||||
fi
|
fi
|
||||||
|
@ -405,7 +408,7 @@ get_merge_tool_path () {
|
||||||
get_merge_tool () {
|
get_merge_tool () {
|
||||||
is_guessed=false
|
is_guessed=false
|
||||||
# Check if a merge tool has been configured
|
# Check if a merge tool has been configured
|
||||||
merge_tool=$(get_configured_merge_tool $GIT_MERGETOOL_GUI)
|
merge_tool=$(get_configured_merge_tool)
|
||||||
# Try to guess an appropriate merge tool if no tool has been set.
|
# Try to guess an appropriate merge tool if no tool has been set.
|
||||||
if test -z "$merge_tool"
|
if test -z "$merge_tool"
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue