Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Files with spaces in name and TortoiseMerge #57

Closed
Fr0sT-Brutal opened this Issue · 19 comments

3 participants

@Fr0sT-Brutal

What steps will reproduce the problem?
1. Add file with space in the name ("New file") and make merge conflict on it
2. perform "git mergetool" in command-line

What is the expected output? What do you see instead?
Expect merge tool to load file versions for merging
But it gives an error
"The diffing engine aborted because of an error:
Can't open file '.\New'"

What version of TortoiseGit and msysgit are you using? On
what operating system?
TortoiseGit-2012-08-04-248f1de-32bit, Git-1.7.11-preview20120710
WinXP SP3

Tortoisemerge's commandline is:
d:\Coding\Tools\TortoiseGIT\bin\tortoisemerge.exe "-base:./New File.BASE.2736" "-mine:./New File.LOCAL.2736" "-theirs:./New File.REMOTE.2736" "-merged:New File"

while it should be ...-base:"./New File.BASE.2736" and so on.

Firstly I posted this issue on TGit page here: http://code.google.com/p/tortoisegit/issues/detail?id=1324 but guys redirected me here.

@sschuberth
Owner

Confirmed. This seems to be yet another MSYS path mangling issue due to TortoiseMerge requiring the rather uncommon ":" to separate the command line switch from the file name. I proposed a work-around in the above TortoiseGit issue.

@sschuberth sschuberth was assigned
@sschuberth
Owner

@csware Any chance to implement what I've suggested here?

@csware

this breaks our/the tsvn cli parameter parser. we're preparing 1.8.0 right now, so it won't be in the next release.

@sschuberth
Owner

@csware Why does adding an alternate syntax break anything? I'm not suggesting to replace ":" by "=", but to accept it in addition.

@csware

I've a patch for it and it works so far.

When do you release the next msysgit version?

@sschuberth: unforseen side effects? The TGit team agreed on a code freeze for 1.8.0, so I've to ask all team members if we can get this into 1.8.0 or if the first chance is 1.8.1.

Btw. we renamed TortoiseMerge.exe to TortoiseGitMerge.exe.

@sschuberth
Owner

Personally, I'd like to wait for Inno Setup 5.5.3 to be released before we release Git for Windows 1.8.1.1. Sure, unforeseen side effects are always possible, but you were saying that "this breaks our/the tsvn cli parameter parser" (in any case), which is a totally different statement.

@sschuberth
Owner

You need to do more than that, which is why I said that we would require "changes in both TortoiseGit/Merge and msysgit". IIRC, you need to either use "-base" or "//base" (same for the other command line options to TortoiseGitMerge, of course).

@csware csware referenced this issue in TortoiseGit/TortoiseGit
Closed

Also accept "=" as separator in command line parser #26

@csware

@sschuberth Shall I send a patch to the git mailing list? Also I'd like to add you as "Signed-off-by" because it's based on your idea. Is it ok?

@sschuberth
Owner

@csware Yes, I'd appreciate if you could prepare a patch for upstream Git. However, I think we should not patch the existing tortoisemerge script but introduce a new tortoisegitmerge script that accounts for both the tool name change and the command line change. Otherwise people would not be able to use the tortoisemerge script with older versions of TortoiseGit (or with TortoiseMerge from TortoiseSVN for that matter), and we would probably be asked by upstream to add some kind of version check to the tortoisemerge script. To avoid all that, I'd suggest to just duplicate the script and adapt it.

Also, please but me on CC for your patch in any case.

@csware

@sschuberth
sh.exe still adds "wrong" quotes if we just replace ":" by "=" for filenames with spaces: "-base=./Neues Textdokument.txt.BASE.3872.txt" "-mine=./Neues Textdokument.txt.LOCAL.3872.txt" "-theirs=./Neues Textdokument.txt.REMOTE.3872.txt" "-merged=Neues Textdokument.txt"

        "$merge_tool_path" \
            -base="$BASE" -mine="$LOCAL" \
            -theirs="$REMOTE" -merged="$MERGED"

So this seems to be more a sh issue (quoting is done in unix style instead of Windows style), instead of a TMerge issue.

Also

        tool="-base=\"$BASE\" -mine=\"$LOCAL\" -theirs=\"$REMOTE\" -merged:\"$MERGED\""
        $merge_tool_path $tool

does not work. $tool contains correct quotes, but quotes are escaped when used as parameter.

@sschuberth
Owner

@csware Can you please post an URL to a patched TortoiseGitMerge.exe that supports "=" in addition to ":"? I'd like to do some testing myself.

@sschuberth
Owner

@csware Thanks, but that archive unfortunately is missing libapr_tgitmerge.dll (and probably other dependencies). Would you mind adding them?

@csware

@sschuberth You could also easily use e.g. the Process Explorer to see which cli parameters were used. However, I've updated the file.

@csware

@sschuberth Any progress?

@sschuberth
Owner

@csware I cannot get it to work either, neither using ":" nor "=". But it seems it would work if TortoiseGitMerge supported " " (a space) to separate "-base" from "filename".

@csware

Yeah, supposed so. I worked the "half evening" on this: TortoiseGit/TortoiseGit#27

@csware

We have an improved cli parser and we're testing it right now.
Submitted patch upstream: http://thread.gmane.org/gmane.comp.version-control.git/214006

@sschuberth
Owner

The fix is in upstream Git 1.8.2 which was released recently. I'll leave this open until we do the rebasing merge and the 1.8.2 release for Windows.

@sschuberth
Owner

The fix is in the released Git for Windows 1.8.3 (we skipped 1.8.2 on Windows).

@sschuberth sschuberth closed this
@farazoman farazoman referenced this issue from a commit
Sven Strickroth 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] #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>
81ed7b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.