Commit e36d7167 authored by Jacob Nisnevich's avatar Jacob Nisnevich Committed by Junio C Hamano

mergetools: create mergetool_find_win32_cmd() helper function for winmerge

Signed-off-by: default avatarJacob Nisnevich <jacob.nisnevich@gmail.com>
Acked-by: David Aguilar's avatarDavid Aguilar <davvid@gmail.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 56331f87
......@@ -372,3 +372,28 @@ get_merge_tool () {
fi
echo "$merge_tool"
}
mergetool_find_win32_cmd () {
executable=$1
sub_directory=$2
# Use $executable if it exists in $PATH
if type -p "$executable" >/dev/null 2>&1
then
printf '%s' "$executable"
return
fi
# Look for executable in the typical locations
for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
cut -d '=' -f 2- | sort -u)
do
if test -n "$directory" && test -x "$directory/$sub_directory/$executable"
then
printf '%s' "$directory/$sub_directory/$executable"
return
fi
done
printf '%s' "$executable"
}
......@@ -13,24 +13,5 @@ merge_cmd () {
}
translate_merge_tool_path() {
# Use WinMergeU.exe if it exists in $PATH
if type -p WinMergeU.exe >/dev/null 2>&1
then
printf WinMergeU.exe
return
fi
# Look for WinMergeU.exe in the typical locations
winmerge_exe="WinMerge/WinMergeU.exe"
for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
cut -d '=' -f 2- | sort -u)
do
if test -n "$directory" && test -x "$directory/$winmerge_exe"
then
printf '%s' "$directory/$winmerge_exe"
return
fi
done
printf WinMergeU.exe
mergetool_find_win32_cmd "WinMergeU.exe" "WinMerge"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment