Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Files with spaces in name and TortoiseMerge #57

Closed
Fr0sT-Brutal opened this issue Aug 13, 2012 · 19 comments
Closed

Files with spaces in name and TortoiseMerge #57

Fr0sT-Brutal opened this issue Aug 13, 2012 · 19 comments
Assignees

Comments

@Fr0sT-Brutal
Copy link

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
Copy link
Contributor

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.

@ghost ghost assigned sschuberth Jan 15, 2013
@sschuberth
Copy link
Contributor

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

@csware
Copy link
Contributor

csware commented Jan 17, 2013

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
Copy link
Contributor

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

@csware
Copy link
Contributor

csware commented Jan 18, 2013

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

csware commented Jan 18, 2013

@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
Copy link
Contributor

@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
Copy link
Contributor

csware commented Jan 18, 2013

@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
Copy link
Contributor

@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
Copy link
Contributor

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

@csware
Copy link
Contributor

csware commented Jan 19, 2013

@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
Copy link
Contributor

csware commented Jan 19, 2013

@sschuberth Any progress?

@sschuberth
Copy link
Contributor

@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
Copy link
Contributor

csware commented Jan 19, 2013

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

@csware
Copy link
Contributor

csware commented Jan 20, 2013

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
Copy link
Contributor

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
Copy link
Contributor

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

ingydotnet pushed a commit to ingydotnet/git that referenced this issue Feb 15, 2016
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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants