git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git difftool and proper path escaping on windows

From
PSPhil Susi <phillsusi@gmail.com>
Date
May 8, 2015, 17:31 UTC
Message-ID
<554CF2D9.3050608@gmail.com>

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?

Next: David Aguilar
Message 1 of 3 in “git difftool and proper path escaping on windows”
  1. Phil SusiMay 8, 2015
  2. David AguilarMay 10, 2015
  3. Philip OakleyMay 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.