{"thread":{"id":"21818","subject":"Re: [Cygwin 1.7] git difftool does not work with Windows kdiff3","startedAt":"2009-12-02T05:11:52Z","lastAt":"2009-12-02T05:11:52Z","messageCount":1,"participants":["David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"128966","messageId":"20091202051151.GA45348@gmail.com","threadId":"21818","inReplyTo":"db95995b0911301445v3b757f75y7f4eaf4abaaa9f80@mail.gmail.com","subject":"Re: [Cygwin 1.7] git difftool does not work with Windows kdiff3","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2009-12-02T05:11:52Z","receivedAt":"2009-12-02T05:11:52Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"I added the git list to the CC: list.\n\nOn Tue, Dec 01, 2009 at 11:45:35AM +1300, David Antliff wrote:\n> \n> git-mergetool works very well with a native Windows (i.e. not Cygwin)\n> installation of kdiff3 because it creates its working files in the\n> current working directory, usually called\n> ./<original-file>.LOCAL.xxxx.<ext> and\n> ./<original-file>.REMOTE.xxxx.<ext>. Because these paths are relative\n> to the CWD, the non-Cygwin version of kdiff3 handles this fine. E.g:\n> \n> kdiff3 --auto --L1 build.xml (Base) --L2 build.xml (Local) --L3\n> build.xml (Remote) -o build.xml ./build.xml.BASE.5512.xml\n> ./build.xml.LOCAL.5512.xml ./build.xml.REMOTE.5512.xml\n> \n> But git-difftool does something slightly different - it creates the\n> temporary versions of the file in /tmp with a random prefix, e.g.\n> /tmp/Vc0BZy_<original-file>. This causes the Windows version of kdiff3\n> to fail to open the file, because the path \"/tmp/....\" is invalid. In\n> my case, the path that would work is \"c:/cygwin-1.7/tmp/...\" instead:\n> \n> kdiff3 --auto --L1 \"build.xml (A)\" --L2 \"build.xml (B)\"\n> /tmp/Vc0BZy_build.xml build.xml\n> \n> It's the  /tmp/... bit that kdiff3 can't understand. On the other\n> hand, this command does work:\n> \n> kdiff3 --auto --L1 \"build.xml (A)\" --L2 \"build.xml (B)\"\n> c:/cygwin-1.7/tmp/Vc0BZy_build.xml build.xml\n> \n> \n> Perhaps git-difftool should create the temporary file in CWD just like\n> git-mergetool, rather than the Cygwin-specific path /tmp?\n> \n> I'm using the Windows version of kdiff3 to avoid dependency on the\n> graphical X libraries that Cygwin's kdiff3 would require. I think it's\n> a fairly common thing to do when working with git on Windows. I can\n> see that the Cygwin version of kdiff3 would probably not exhibit this\n> problem.\n> \n> I imagine the same problem will occur with other Windows versions of\n> merge/diff tools.\n> \n> I also understand if there's no intention by the Cygwin git\n> maintainer to support non-Cygwin gui merge tools, but I don't think\n> I'm the only person using them extensively.\n> \n> -- David.\n\n\ngit-difftool is built on top of git's GIT_EXTERNAL_DIFF\nmechanism.  So this problem is not specific to difftool.\n\nI don't have a general solution for you but I do have\na workaround until a better solution manifests itself.\n\nHere's one workaround:\n\n\t$ TMPDIR=.\n\t$ export TMPDIR\n\ngit honors $TMPDIR and that'll make git write files in\nthe current directory.\n\nLikewise, running `git difftool` should work since the\npaths handed off to the difftool should be e.g.\n./XXXXXX_build.xml.\n\nThat said, I don't know if git dereferences the \".\" thus\nmaking the workaround invalid.  I haven't tested it.\n\n\nIf that doesn't work then there's another alternative.\nYou could write a simple kdiff3 wrapper script to\ntranslate the cygwin paths into Windows-native paths.\n\nDrop it in the front of $PATH and it'll magically\nwork.  Otherwise, set the difftool.kdiff3.path\nconfiguration variable to the path of the wrapper\nscript and difftool will use your wrapper without\nit being in $PATH.\n\nI hope that helps for now.\n\n\n\nAn aside:\n\nI've always tested git-difftool on Windows using msysgit.\nWindows-native kdiff3 is one of the tools that I've tested\nand didn't have any problems using msysgit and native kdiff3\ntogether.\n\ncygwin git and msysgit are very different, of course.\nIt's likely that msysgit does a lot more magic to\nmake this possible, but I just wanted to throw that\nout there.\n\nIf anyone knows of a general solution to this problem\nthen I'm all ears.\n\n\nGood luck and let us know how it goes,\n\n-- \n\t\tDavid\n"}]}