This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [1.7] git-difftool paths unusable by win32 kdiff3


David Antliff wrote:
> In git-1.6.1.2 [1.5] and git-1.6.4.2 [1.7] there is a command called
> 'git-mergetool' that is used as a wrapper for various graphical
> merging tools, such as kdiff3. It makes local copies of the relevant
> commits and brings up an interactive gui for resolving merge conflicts.
> 
> In git-1.6.4.2 there is a new command called 'git difftool' that does
> a very similar thing, except it's designed to show the output of 'git
> diff' in a graphical tool, rather than a merge.
> 
> git-mergetool works very well with a native Windows (i.e. not Cygwin)
> installation of kdiff3 because it creates its working files in the
> current working directory, usually called:
>  ./<original-file>.LOCAL.xxxx.<ext> and ./<original-file>.REMOTE.xxxx.<ext>.
> Because these paths are relative to the CWD, the non-Cygwin version of
> kdiff3 handles this fine. E.g:
> 
> kdiff3 --auto --L1 build.xml (Base) --L2 build.xml (Local) --L3
> build.xml (Remote) -o build.xml ./build.xml.BASE.5512.xml
> ./build.xml.LOCAL.5512.xml ./build.xml.REMOTE.5512.xml
> 
> But git-difftool does something slightly different - it creates the
> temporary versions of the file in /tmp with a random prefix, e.g.
> /tmp/Vc0BZy_<original-file>. This causes the Windows version of kdiff3
> to fail to open the file, because the path "/tmp/...." is invalid. In
> my case, the path that would work is "c:/cygwin-1.7/tmp/..." instead:
> 
> kdiff3 --auto --L1 "build.xml (A)" --L2 "build.xml (B)"
> /tmp/Vc0BZy_build.xml build.xml
> 
> It's the  /tmp/... bit that kdiff3 can't understand. On the other
> hand, this command does work:
> 
> kdiff3 --auto --L1 "build.xml (A)" --L2 "build.xml (B)"
> c:/cygwin-1.7/tmp/Vc0BZy_build.xml build.xml

As a fairly simple workaround, you could create a wrapper script which
takes the same set of arguments git difftool gives to kdiff3 and
converts the given file paths using cygpath -w before exec'ing the real
kdiff3.  Then you can point to that wrapper by setting the git
configuration variable difftool.kdiff3.path to the path for the wrapper
script.  Run "git difftool --help" for more information.

> Perhaps git-difftool should create the temporary file in CWD just like
> git-mergetool, rather than the Cygwin-specific path /tmp?

If you want git difftool to function more like git mergetool with
respect to temporary files, you probably need to ask the git maintainers
about it rather than the git package maintainer for Cygwin.  That's what
I would do at least. :-)

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]