Skip to content

Commit 884630b

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05fb872 commit 884630b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

git-mergetool--lib.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,18 @@ show_tool_names () {
8080
}
8181
}
8282

83-
diff_mode() {
83+
diff_mode () {
8484
test "$TOOL_MODE" = diff
8585
}
8686

87-
merge_mode() {
87+
merge_mode () {
8888
test "$TOOL_MODE" = merge
8989
}
9090

91+
gui_mode () {
92+
test "$GIT_MERGETOOL_GUI" = true
93+
}
94+
9195
translate_merge_tool_path () {
9296
echo "$1"
9397
}
@@ -350,8 +354,7 @@ guess_merge_tool () {
350354
}
351355

352356
get_configured_merge_tool () {
353-
# If first argument is true, find the guitool instead
354-
if test "$1" = true
357+
if gui_mode
355358
then
356359
gui_prefix=gui
357360
fi
@@ -405,7 +408,7 @@ get_merge_tool_path () {
405408
get_merge_tool () {
406409
is_guessed=false
407410
# 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)
409412
# Try to guess an appropriate merge tool if no tool has been set.
410413
if test -z "$merge_tool"
411414
then

0 commit comments

Comments
 (0)