* git difftool and proper path escaping on windows
@ 2015-05-08 17:31 Phil Susi
2015-05-10 20:15 ` David Aguilar
0 siblings, 1 reply; 3+ messages in thread
From: Phil Susi @ 2015-05-08 17:31 UTC (permalink / raw)
To: git
I'm trying to have git difftool run winmerge to compare files, but it
seems to be doing something silly with path translation. My first
attempt was:
git difftool -x /c/Program\ Files\ \(x86\)/WinMerge/WinMergeU.exe
To which it responded:
C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
eval: line 61: syntax error near unexpected token `('
C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
eval: line 61: `c:/Program Files (x86)/WinMerge/WinMergeU.exe "$LOCAL"
"$REMOTE
My first thought was that my shell removed the backslash escapes and
then git tried to pass the remaining command to another shell. So I
wrapped the path in single quotes, which should pass the escapes to git,
which should pass them to the shell, which should then be able to parse
the spaces in parenthesis in the path, but instead I got this:
Launch 'c:/Program/ Files/ /(x86/)/WinMerge/WinMergeU.exe'
So it appears that git is replacing backslashes with forward slashes,
then trying to pass that to the shell, which doesn't work. Any idea how
to fix or workaround this bug?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git difftool and proper path escaping on windows
2015-05-08 17:31 git difftool and proper path escaping on windows Phil Susi
@ 2015-05-10 20:15 ` David Aguilar
2015-05-10 21:09 ` Philip Oakley
0 siblings, 1 reply; 3+ messages in thread
From: David Aguilar @ 2015-05-10 20:15 UTC (permalink / raw)
To: Phil Susi, git
On May 8, 2015 10:31:05 AM PDT, Phil Susi <phillsusi@gmail.com> wrote:
>I'm trying to have git difftool run winmerge to compare files, but it
>seems to be doing something silly with path translation. My first
>attempt was:
>
>git difftool -x /c/Program\ Files\ \(x86\)/WinMerge/WinMergeU.exe
>
>To which it responded:
>
>C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
> eval: line 61: syntax error near unexpected token `('
>
>C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
>eval: line 61: `c:/Program Files (x86)/WinMerge/WinMergeU.exe "$LOCAL"
>"$REMOTE
>
>
>My first thought was that my shell removed the backslash escapes and
>then git tried to pass the remaining command to another shell. So I
>wrapped the path in single quotes, which should pass the escapes to
>git,
>which should pass them to the shell, which should then be able to parse
>
>the spaces in parenthesis in the path, but instead I got this:
>
>Launch 'c:/Program/ Files/ /(x86/)/WinMerge/WinMergeU.exe'
>
>So it appears that git is replacing backslashes with forward slashes,
>then trying to pass that to the shell, which doesn't work. Any idea
>how
>to fix or workaround this bug?
paths and executing external programs on windows is confusing and error-prone for a simple unix user such as myself.
I think you might be able to work around the difficulties by making the tool available in your $PATH, that way you don't have to play shell quoting / escaping games.
I hope that helps. if you discover a different solution, I'd be happy to document it so that windows users don't have to rediscover how to do it in the future.
let me know how it goes.
cheers
--
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git difftool and proper path escaping on windows
2015-05-10 20:15 ` David Aguilar
@ 2015-05-10 21:09 ` Philip Oakley
0 siblings, 0 replies; 3+ messages in thread
From: Philip Oakley @ 2015-05-10 21:09 UTC (permalink / raw)
To: David Aguilar, Phil Susi, git
From: "David Aguilar" <davvid@gmail.com>
> On May 8, 2015 10:31:05 AM PDT, Phil Susi <phillsusi@gmail.com> wrote:
>>I'm trying to have git difftool run winmerge to compare files, but it
>>seems to be doing something silly with path translation. My first
>>attempt was:
>>
>>git difftool -x /c/Program\ Files\ \(x86\)/WinMerge/WinMergeU.exe
>>
>>To which it responded:
>>
>>C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
>> eval: line 61: syntax error near unexpected token `('
>>
>>C:\Users\psusi\AppData\Local\Programs\Git/libexec/git-core\git-difftool--helper:
>>eval: line 61: `c:/Program Files (x86)/WinMerge/WinMergeU.exe "$LOCAL"
>>"$REMOTE
>>
>>
>>My first thought was that my shell removed the backslash escapes and
>>then git tried to pass the remaining command to another shell. So I
>>wrapped the path in single quotes, which should pass the escapes to
>>git,
>>which should pass them to the shell, which should then be able to
>>parse
>>
>>the spaces in parenthesis in the path, but instead I got this:
>>
>>Launch 'c:/Program/ Files/ /(x86/)/WinMerge/WinMergeU.exe'
>>
>>So it appears that git is replacing backslashes with forward slashes,
>>then trying to pass that to the shell, which doesn't work. Any idea
>>how
>>to fix or workaround this bug?
>
>
> paths and executing external programs on windows is confusing and
> error-prone for a simple unix user such as myself.
>
> I think you might be able to work around the difficulties by making
> the tool available in your $PATH, that way you don't have to play
> shell quoting / escaping games.
>
> I hope that helps. if you discover a different solution, I'd be happy
> to document it so that windows users don't have to rediscover how to
> do it in the future.
>
> let me know how it goes.
> cheers
>
A quick web browse found https://gist.github.com/shawndumas/6158524 as
one example of a winmerge configuration.
my personal .gitconfig has
[difftool "WinMerge"]
path = C:/Program Files/WinMerge/WinMergeU.exe
cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' /e /x /u $LOCAL $REMOTE
[mergetool "WinMerge"]
path = C:/Program Files/WinMerge/WinMergeU.exe
cmd = 'C:/Program Files/WinMerge/WinMergeU.exe' /e /x /u $LOCAL $REMOTE
$MERGED
trustExitCode = false
(excuse whitespace damage)
though I don't use it much.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-10 21:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-08 17:31 git difftool and proper path escaping on windows Phil Susi
2015-05-10 20:15 ` David Aguilar
2015-05-10 21:09 ` Philip Oakley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).