# Error after calling git difftool -d with

6 messages from 2016-12-02 to 2016-12-09. Participants: P. Duijst, Johannes Schindelin, David Aguilar.
Thread: https://gitlist.dev/t/44590

## P. Duijst, 2016-12-02 12:15

Subject: Error after calling git difftool -d with
Message-ID: <5f630c90-cf54-3a23-c9a9-af035d4514e0@gmail.com>
URL: https://gitlist.dev/e/5f630c90-cf54-3a23-c9a9-af035d4514e0%40gmail.com

```
Dear,

Incase filenames are used with a quote ' or a bracket [  (and maybe some 
more characters), git "diff" and "difftool -y" works fine, but git 
*difftool **-d* gives the next error message:

    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
    $ git diff
    diff --git a/Test ''inch.txt b/Test ''inch.txt
    index dbff793..41f3257 100644
    --- a/Test ''inch.txt
    +++ b/Test ''inch.txt
    @@ -1 +1,3 @@
    +
    +ddd
      Test error in simple repository
    warning: LF will be replaced by CRLF in Test ''inch.txt.
    The file will have its original line endings in your working directory.

    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
    *$ git difftool -d*
    *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
    directory*
    *hash-object /d/Dev/test//Test ''inch.txt: command returned error: 128*

    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
    $


This issue is inside V2.10.x and V2.11.0.
V2.9.0 is working correctly...

I am using git for windows and beyond compare 4.0 as difftool.

Best regards,

Peter

```

## Johannes Schindelin, 2016-12-02 16:05

Subject: Re: Error after calling git difftool -d with
Message-ID: <alpine.DEB.2.20.1612021704170.117539@virtualbox>
URL: https://gitlist.dev/e/alpine.DEB.2.20.1612021704170.117539%40virtualbox
In-Reply-To: <5f630c90-cf54-3a23-c9a9-af035d4514e0@gmail.com>

```
Hi Peter,

On Fri, 2 Dec 2016, P. Duijst wrote:

> Incase filenames are used with a quote ' or a bracket [  (and maybe some more
> characters), git "diff" and "difftool -y" works fine, but git *difftool **-d*
> gives the next error message:
> 
>    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>    $ git diff
>    diff --git a/Test ''inch.txt b/Test ''inch.txt
>    index dbff793..41f3257 100644
>    --- a/Test ''inch.txt
>    +++ b/Test ''inch.txt
>    @@ -1 +1,3 @@
>    +
>    +ddd
>      Test error in simple repository
>    warning: LF will be replaced by CRLF in Test ''inch.txt.
>    The file will have its original line endings in your working directory.
> 
>    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>    *$ git difftool -d*
>    *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
>    directory*
>    *hash-object /d/Dev/test//Test ''inch.txt: command returned error: 128*
> 
>    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>    $
> 
> 
> This issue is inside V2.10.x and V2.11.0.
> V2.9.0 is working correctly...

You say v2.11.0, but did you also try the new, experimental builtin
difftool? You can test without reinstalling:

	git -c difftool.useBuiltin=true difftool -d ...

Ciao,
Johannes

```

## David Aguilar, 2016-12-05 05:15

Subject: Re: Error after calling git difftool -d with
Message-ID: <20161205051510.itftw4hyzkv6nnxn@gmail.com>
URL: https://gitlist.dev/e/20161205051510.itftw4hyzkv6nnxn%40gmail.com
In-Reply-To: <alpine.DEB.2.20.1612021704170.117539@virtualbox>

```
On Fri, Dec 02, 2016 at 05:05:06PM +0100, Johannes Schindelin wrote:
> Hi Peter,
> 
> On Fri, 2 Dec 2016, P. Duijst wrote:
> 
> > Incase filenames are used with a quote ' or a bracket [  (and maybe some more
> > characters), git "diff" and "difftool -y" works fine, but git *difftool **-d*
> > gives the next error message:
> > 
> >    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> >    $ git diff
> >    diff --git a/Test ''inch.txt b/Test ''inch.txt
> >    index dbff793..41f3257 100644
> >    --- a/Test ''inch.txt
> >    +++ b/Test ''inch.txt
> >    @@ -1 +1,3 @@
> >    +
> >    +ddd
> >      Test error in simple repository
> >    warning: LF will be replaced by CRLF in Test ''inch.txt.
> >    The file will have its original line endings in your working directory.
> > 
> >    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> >    *$ git difftool -d*
> >    *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
> >    directory*
> >    *hash-object /d/Dev/test//Test ''inch.txt: command returned error: 128*
> > 
> >    peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> >    $
> > 
> > 
> > This issue is inside V2.10.x and V2.11.0.
> > V2.9.0 is working correctly...
> 
> You say v2.11.0, but did you also try the new, experimental builtin
> difftool? You can test without reinstalling:
> 
> 	git -c difftool.useBuiltin=true difftool -d ...

FWIW, I verified that this problem does not manifest itself on
Linux, using the current scripted difftool.

Peter, what actual diff tool are you using?

Since these filenames work fine with "difftool -d" on Linux, it
suggests that this is either a tool-specific issue, or an issue
related to unix-to-windows path translation.
-- 
David

```

## P. Duijst, 2016-12-05 07:58

Subject: Re: Error after calling git difftool -d with
Message-ID: <c0c8c333-adfa-ad58-f1ec-7239a3a16528@gmail.com>
URL: https://gitlist.dev/e/c0c8c333-adfa-ad58-f1ec-7239a3a16528%40gmail.com
In-Reply-To: <20161205051510.itftw4hyzkv6nnxn@gmail.com>

```
On 12/5/2016 06:15, David Aguilar wrote:
> On Fri, Dec 02, 2016 at 05:05:06PM +0100, Johannes Schindelin wrote:
>> Hi Peter,
>>
>> On Fri, 2 Dec 2016, P. Duijst wrote:
>>
>>> Incase filenames are used with a quote ' or a bracket [  (and maybe some more
>>> characters), git "diff" and "difftool -y" works fine, but git *difftool **-d*
>>> gives the next error message:
>>>
>>>     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>>>     $ git diff
>>>     diff --git a/Test ''inch.txt b/Test ''inch.txt
>>>     index dbff793..41f3257 100644
>>>     --- a/Test ''inch.txt
>>>     +++ b/Test ''inch.txt
>>>     @@ -1 +1,3 @@
>>>     +
>>>     +ddd
>>>       Test error in simple repository
>>>     warning: LF will be replaced by CRLF in Test ''inch.txt.
>>>     The file will have its original line endings in your working directory.
>>>
>>>     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>>>     *$ git difftool -d*
>>>     *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
>>>     directory*
>>>     *hash-object /d/Dev/test//Test ''inch.txt: command returned error: 128*
>>>
>>>     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
>>>     $
>>>
>>>
>>> This issue is inside V2.10.x and V2.11.0.
>>> V2.9.0 is working correctly...
>> You say v2.11.0, but did you also try the new, experimental builtin
>> difftool? You can test without reinstalling:
>>
>> 	git -c difftool.useBuiltin=true difftool -d ...
> FWIW, I verified that this problem does not manifest itself on
> Linux, using the current scripted difftool.
>
> Peter, what actual diff tool are you using?
>
> Since these filenames work fine with "difftool -d" on Linux, it
> suggests that this is either a tool-specific issue, or an issue
> related to unix-to-windows path translation.
Hi all,

@Johannes: "git -c difftool.useBuiltin=true difftool -d" works OK :-), 
beyond compare is launching with the diff's displayed
@David: I am using Beyond Compare V4.1.9

Best regards,

Peter


```

## Johannes Schindelin, 2016-12-05 10:56

Subject: Re: Error after calling git difftool -d with
Message-ID: <alpine.DEB.2.20.1612051142550.117539@virtualbox>
URL: https://gitlist.dev/e/alpine.DEB.2.20.1612051142550.117539%40virtualbox
In-Reply-To: <c0c8c333-adfa-ad58-f1ec-7239a3a16528@gmail.com>

```
Hi Peter,

On Mon, 5 Dec 2016, P. Duijst wrote:

> On 12/5/2016 06:15, David Aguilar wrote:
> > On Fri, Dec 02, 2016 at 05:05:06PM +0100, Johannes Schindelin wrote:
> > >
> > > On Fri, 2 Dec 2016, P. Duijst wrote:
> > >
> > > > Incase filenames are used with a quote ' or a bracket [  (and
> > > > maybe some more characters), git "diff" and "difftool -y" works
> > > > fine, but git *difftool **-d* gives the next error message:
> > > >
> > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > >     $ git diff
> > > >     diff --git a/Test ''inch.txt b/Test ''inch.txt
> > > >     index dbff793..41f3257 100644
> > > >     --- a/Test ''inch.txt
> > > >     +++ b/Test ''inch.txt
> > > >     @@ -1 +1,3 @@
> > > >     +
> > > >     +ddd
> > > >       Test error in simple repository
> > > >     warning: LF will be replaced by CRLF in Test ''inch.txt.
> > > >     The file will have its original line endings in your working
> > > >     directory.
> > > >
> > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > >     *$ git difftool -d*
> > > >     *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
> > > >     directory*
> > > >     *hash-object /d/Dev/test//Test ''inch.txt: command returned error:
> > > >     128*
> > > >
> > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > >     $
> > > >
> > > >
> > > > This issue is inside V2.10.x and V2.11.0.
> > > > V2.9.0 is working correctly...
> > > You say v2.11.0, but did you also try the new, experimental builtin
> > > difftool? You can test without reinstalling:
> > >
> > >  git -c difftool.useBuiltin=true difftool -d ...
> >
> > FWIW, I verified that this problem does not manifest itself on Linux,
> > using the current scripted difftool.
> >
> > Peter, what actual diff tool are you using?
> >
> > Since these filenames work fine with "difftool -d" on Linux, it
> > suggests that this is either a tool-specific issue, or an issue
> > related to unix-to-windows path translation.
> 
> @Johannes: "git -c difftool.useBuiltin=true difftool -d" works OK :-), beyond
> compare is launching with the diff's displayed

Perfect.

In that case, I think it is not worth fixing the scripted tool but focus
on getting rid of it in favor of the builtin version.

It's not like it is the only problem with having difftool implemented
as a script...

Ciao,
Johannes

```

## David Aguilar, 2016-12-09 09:47

Subject: Re: Error after calling git difftool -d with
Message-ID: <20161209094733.f2ism4snbrsbe2nw@gmail.com>
URL: https://gitlist.dev/e/20161209094733.f2ism4snbrsbe2nw%40gmail.com
In-Reply-To: <alpine.DEB.2.20.1612051142550.117539@virtualbox>

```
On Mon, Dec 05, 2016 at 11:56:31AM +0100, Johannes Schindelin wrote:
> Hi Peter,
> 
> On Mon, 5 Dec 2016, P. Duijst wrote:
> 
> > On 12/5/2016 06:15, David Aguilar wrote:
> > > On Fri, Dec 02, 2016 at 05:05:06PM +0100, Johannes Schindelin wrote:
> > > >
> > > > On Fri, 2 Dec 2016, P. Duijst wrote:
> > > >
> > > > > Incase filenames are used with a quote ' or a bracket [  (and
> > > > > maybe some more characters), git "diff" and "difftool -y" works
> > > > > fine, but git *difftool **-d* gives the next error message:
> > > > >
> > > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > > >     $ git diff
> > > > >     diff --git a/Test ''inch.txt b/Test ''inch.txt
> > > > >     index dbff793..41f3257 100644
> > > > >     --- a/Test ''inch.txt
> > > > >     +++ b/Test ''inch.txt
> > > > >     @@ -1 +1,3 @@
> > > > >     +
> > > > >     +ddd
> > > > >       Test error in simple repository
> > > > >     warning: LF will be replaced by CRLF in Test ''inch.txt.
> > > > >     The file will have its original line endings in your working
> > > > >     directory.
> > > > >
> > > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > > >     *$ git difftool -d*
> > > > >     *fatal: Cannot open '/d/Dev/test//Test ''inch.txt': No such file or
> > > > >     directory*
> > > > >     *hash-object /d/Dev/test//Test ''inch.txt: command returned error:
> > > > >     128*
> > > > >
> > > > >     peter@scm_ws_10 MINGW64 /d/Dev/test (master)
> > > > >     $
> > > > >
> > > > >
> > > > > This issue is inside V2.10.x and V2.11.0.
> > > > > V2.9.0 is working correctly...
> > > > You say v2.11.0, but did you also try the new, experimental builtin
> > > > difftool? You can test without reinstalling:
> > > >
> > > >  git -c difftool.useBuiltin=true difftool -d ...
> > >
> > > FWIW, I verified that this problem does not manifest itself on Linux,
> > > using the current scripted difftool.
> > >
> > > Peter, what actual diff tool are you using?
> > >
> > > Since these filenames work fine with "difftool -d" on Linux, it
> > > suggests that this is either a tool-specific issue, or an issue
> > > related to unix-to-windows path translation.
> > 
> > @Johannes: "git -c difftool.useBuiltin=true difftool -d" works OK :-), beyond
> > compare is launching with the diff's displayed
> 
> Perfect.
> 
> In that case, I think it is not worth fixing the scripted tool but focus
> on getting rid of it in favor of the builtin version.
> 
> It's not like it is the only problem with having difftool implemented
> as a script...

I just sent some patches[1] that makes it so that difftool always
operates from the top-level of the repo, particularly when
calling hash-object.  They also eliminate using paths with
embedded "//" in them, both of which may have caused this issue

Though we can side-step this specific issue with the new builtin
difftool, if our use of hash-object with double-slashed absolute
paths was not the problem reported above, then another
possibility is that there's a problem in the Git.pm Perl module,
which affects more than just difftool.

I'm curious to understand the root cause of the problem.

Does Git.pm go through a shell on Windows?

Why was hash-object complaining about the correct path,
but reported that it didn't exist?
Did having "//" in the path cause the problem?

Enlightenment from the GFW internals perspective is much
appreciated.

Since this reportedly worked in older versions, I'm led to
believe that 32b8c581ec (difftool: use Git::* functions instead
of passing around state), which first introduced the use of
paths with embedded "//", was the root cause.  If this is true
then the patches should fix the scripted difftool on Windows.

[1] http://public-inbox.org/git/20161209085848.10929-1-davvid@gmail.com/T/#t

cheers,
-- 
David

```
