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] https://github.com/msysgit/msysgit/issues/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>

Sven Strickroth committed Feb 1, 2013 at 21:16 UTC 81ed7b9581f7eafb334824264abb492d85a5ffb8
1 file changed +11 -3
mergetools/tortoisemerge
+11 -3
@@ -6,9 +6,17 @@ merge_cmd () {
6 if $base_present
7 then
8 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
20 check_unchanged
21 else
22 echo "$merge_tool_path cannot be used without a base" 1>&2