Skip to content

Commit 81ed7b9

Browse files
Sven Strickrothgitster
authored andcommitted
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). [1] http://www.mingw.org/wiki/Posix_path_conversion [2] msysgit/msysgit#57 Signed-off-by: Sven Strickroth <email@cs-ware.de> Reported-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8bf6719 commit 81ed7b9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

mergetools/tortoisemerge

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ merge_cmd () {
66
if $base_present
77
then
88
touch "$BACKUP"
9-
"$merge_tool_path" \
10-
-base:"$BASE" -mine:"$LOCAL" \
11-
-theirs:"$REMOTE" -merged:"$MERGED"
9+
basename="$(basename "$merge_tool_path" .exe)"
10+
if test "$basename" = "tortoisegitmerge"
11+
then
12+
"$merge_tool_path" \
13+
-base "$BASE" -mine "$LOCAL" \
14+
-theirs "$REMOTE" -merged "$MERGED"
15+
else
16+
"$merge_tool_path" \
17+
-base:"$BASE" -mine:"$LOCAL" \
18+
-theirs:"$REMOTE" -merged:"$MERGED"
19+
fi
1220
check_unchanged
1321
else
1422
echo "$merge_tool_path cannot be used without a base" 1>&2

0 commit comments

Comments
 (0)