Commit 81ed7b95 authored by Sven Strickroth's avatar Sven Strickroth Committed by Junio C Hamano

mergetools: teach tortoisemerge to handle filenames with SP correctly

TortoiseGitMerge, unlike TortoiseMerge, can be told to handle paths
with spaces in them by using -option "$FILE" (not -option:"$FILE",
which does not work for such paths) syntax.

This change was necessary because of MSYS path mangling [1], the ":"
after the "base" etc. arguments to TortoiseMerge caused the whole
argument instead of just the file name to be quoted in case of file
names with spaces. So TortoiseMerge was passed

    "-base:new file.txt"

instead of

    -base:"new file.txt"

(including the quotes). To work around this, TortoiseGitMerge does not
require the ":" after the arguments anymore which fixes handling file
names with spaces [2] (as written above).

[2] Sven Strickroth's avatarSven Strickroth <>
Reported-by: Sebastian Schuberth's avatarSebastian Schuberth <>
Signed-off-by: default avatarJunio C Hamano <>
parent 8bf67194
......@@ -6,9 +6,17 @@ merge_cmd () {
if $base_present
touch "$BACKUP"
"$merge_tool_path" \
-base:"$BASE" -mine:"$LOCAL" \
-theirs:"$REMOTE" -merged:"$MERGED"
basename="$(basename "$merge_tool_path" .exe)"
if test "$basename" = "tortoisegitmerge"
"$merge_tool_path" \
-base "$BASE" -mine "$LOCAL" \
-theirs "$REMOTE" -merged "$MERGED"
"$merge_tool_path" \
-base:"$BASE" -mine:"$LOCAL" \
-theirs:"$REMOTE" -merged:"$MERGED"
echo "$merge_tool_path cannot be used without a base" 1>&2
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