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>
Denton Liu committed
Apr 29, 2019 at 02:21 UTC
884630b2e2634969656faabc7f4e33cab2e32b35
1 file changed
+8
-5
git-mergetool--lib.sh
+8
-5
@@ -80,14 +80,18 @@ show_tool_names () {
80
}
81
}
82
83
-diff_mode() {
83
+diff_mode () {
84
test "$TOOL_MODE" = diff
85
}
86
87
-merge_mode() {
87
+merge_mode () {
88
test "$TOOL_MODE" = merge
89
}
90
91
+gui_mode () {
92
+ test "$GIT_MERGETOOL_GUI" = true
93
+}
94
+
95
translate_merge_tool_path () {
96
echo "$1"
97
}
@@ -350,8 +354,7 @@ guess_merge_tool () {
354
}
355
356
get_configured_merge_tool () {
353
- # If first argument is true, find the guitool instead
354
- if test "$1" = true
357
+ if gui_mode
358
then
359
gui_prefix=gui
360
fi
@@ -405,7 +408,7 @@ get_merge_tool_path () {
408
get_merge_tool () {
409
is_guessed=false
410
# Check if a merge tool has been configured
408
- merge_tool=$(get_configured_merge_tool $GIT_MERGETOOL_GUI)
411
+ merge_tool=$(get_configured_merge_tool)
412
# Try to guess an appropriate merge tool if no tool has been set.
413
if test -z "$merge_tool"
414
then