# Gitk "External diff" broken when using worktree

4 messages from 2016-03-24 to 2016-03-29. Participants: Daryl Van Den Brink, Duy Nguyen.
Thread: https://gitlist.dev/t/41805

## Daryl Van Den Brink, 2016-03-24 02:55

Subject: Gitk "External diff" broken when using worktree
Message-ID: <CAC4jX8FWs30v-Vh7XyPP9_ba3HKd4hAhRBrwfMpBPZd5ku8rUA@mail.gmail.com>
URL: https://gitlist.dev/e/CAC4jX8FWs30v-Vh7XyPP9_ba3HKd4hAhRBrwfMpBPZd5ku8rUA%40mail.gmail.com

```
Hi,

I'm using git 2.7.3 on cygwin, and have been taking advantage of the
new "git worktree" feature. I noticed that when I launch gitk from one
of the attached working directories, its "external diff" feature
doesn't seem to work. Nothing shows up in the diff tool at all.
However, it works if you launch gitk from the main repository.

To reproduce:
1. Create a new working tree with "git worktree add"
2. From that new worktree, launch gitk.
3. Right-click in a file in the bottom right pane and click "External diff"
4. No useful diff appears.

-- 
Daryl van den Brink

```

## Duy Nguyen, 2016-03-24 09:22

Subject: Re: Gitk "External diff" broken when using worktree
Message-ID: <CACsJy8D84e4iQ6Pz_zyqsXuV6c2ier6s_W99+1hKszd0gHiUaQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8D84e4iQ6Pz_zyqsXuV6c2ier6s_W99%2B1hKszd0gHiUaQ%40mail.gmail.com
In-Reply-To: <CAC4jX8FWs30v-Vh7XyPP9_ba3HKd4hAhRBrwfMpBPZd5ku8rUA@mail.gmail.com>

```
On Thu, Mar 24, 2016 at 9:55 AM, Daryl Van Den Brink
<daryl.vandenbrink@maptek.com.au> wrote:
> Hi,
>
> I'm using git 2.7.3 on cygwin, and have been taking advantage of the
> new "git worktree" feature. I noticed that when I launch gitk from one
> of the attached working directories, its "external diff" feature
> doesn't seem to work. Nothing shows up in the diff tool at all.
> However, it works if you launch gitk from the main repository.
>
> To reproduce:
> 1. Create a new working tree with "git worktree add"
> 2. From that new worktree, launch gitk.
> 3. Right-click in a file in the bottom right pane and click "External diff"
> 4. No useful diff appears.

Works for me (on linux with 'master' branch). Maybe gitk selected
invalid tempdir on cygwin. You can try replace your external diff
program with a script or something that prints the whole command line.
That should reveal if gitk given paths are correct or not (or if gitk
fails even before that)
-- 
Duy

```

## Daryl Van Den Brink, 2016-03-29 00:17

Subject: Re: Gitk "External diff" broken when using worktree
Message-ID: <CAC4jX8E0URpxYmTU96xaFh-zEfT_q8RNfGy53DoNV5OFNjgxbQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAC4jX8E0URpxYmTU96xaFh-zEfT_q8RNfGy53DoNV5OFNjgxbQ%40mail.gmail.com
In-Reply-To: <CACsJy8D84e4iQ6Pz_zyqsXuV6c2ier6s_W99+1hKszd0gHiUaQ@mail.gmail.com>

```
I've done that, and here are the two arguments that it gives to the diff tool:

>From the main repository (in which case the it works):

.git/.gitk-tmp.CCxPmN/1/[1980e260494cbd225d482b5d962e77bdcdb2321c]
RemoteTransaction.C
.git/.gitk-tmp.CCxPmN/1/[2759bf6053e73cb5f7c11c646aee206242db2cd4]
RemoteTransaction.C

>From the auxiliary worktree (when the diff doesn't work):

/home/daryl.vandenbrink/git-work/mdf_products/.git/worktrees/mdf2/.gitk-tmp.ZEdGpi/1/[1980e260494cbd225d482b5d962e77bdcdb2321c]
RemoteTransaction.C
/home/daryl.vandenbrink/git-work/mdf_products/.git/worktrees/mdf2/.gitk-tmp.ZEdGpi/1/[2759bf6053e73cb5f7c11c646aee206242db2cd4]
RemoteTransaction.C

I hope that helps.


On 24 March 2016 at 19:52, Duy Nguyen <pclouds@gmail.com> wrote:
> On Thu, Mar 24, 2016 at 9:55 AM, Daryl Van Den Brink
> <daryl.vandenbrink@maptek.com.au> wrote:
>> Hi,
>>
>> I'm using git 2.7.3 on cygwin, and have been taking advantage of the
>> new "git worktree" feature. I noticed that when I launch gitk from one
>> of the attached working directories, its "external diff" feature
>> doesn't seem to work. Nothing shows up in the diff tool at all.
>> However, it works if you launch gitk from the main repository.
>>
>> To reproduce:
>> 1. Create a new working tree with "git worktree add"
>> 2. From that new worktree, launch gitk.
>> 3. Right-click in a file in the bottom right pane and click "External diff"
>> 4. No useful diff appears.
>
> Works for me (on linux with 'master' branch). Maybe gitk selected
> invalid tempdir on cygwin. You can try replace your external diff
> program with a script or something that prints the whole command line.
> That should reveal if gitk given paths are correct or not (or if gitk
> fails even before that)
> --
> Duy



-- 
Daryl van den Brink
Software Engineer
Maptek | 31 Flemington Street, Glenside, SA 5065, Australia
Tel: +61-8 8338 9222 | Dir: +61-8 8338 9222 | Fax: +61-8 8338 9229
daryl.vandenbrink@maptek.com.au | www.maptek.com

Keep up to date with Maptek in our Forge newsletter.

```

## Duy Nguyen, 2016-03-29 09:40

Subject: Re: Gitk "External diff" broken when using worktree
Message-ID: <CACsJy8AJr8diCyv=ZfADtm=Aw96RjAHd7ZD2xR6VEQ-ZXQTCBg@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8AJr8diCyv%3DZfADtm%3DAw96RjAHd7ZD2xR6VEQ-ZXQTCBg%40mail.gmail.com
In-Reply-To: <CAC4jX8E0URpxYmTU96xaFh-zEfT_q8RNfGy53DoNV5OFNjgxbQ@mail.gmail.com>

```
On Tue, Mar 29, 2016 at 7:17 AM, Daryl Van Den Brink
<daryl.vandenbrink@maptek.com.au> wrote:
> I've done that, and here are the two arguments that it gives to the diff tool:
>
> From the main repository (in which case the it works):
>
> .git/.gitk-tmp.CCxPmN/1/[1980e260494cbd225d482b5d962e77bdcdb2321c]
> RemoteTransaction.C
> .git/.gitk-tmp.CCxPmN/1/[2759bf6053e73cb5f7c11c646aee206242db2cd4]
> RemoteTransaction.C
>
> From the auxiliary worktree (when the diff doesn't work):
>
> /home/daryl.vandenbrink/git-work/mdf_products/.git/worktrees/mdf2/.gitk-tmp.ZEdGpi/1/[1980e260494cbd225d482b5d962e77bdcdb2321c]
> RemoteTransaction.C
> /home/daryl.vandenbrink/git-work/mdf_products/.git/worktrees/mdf2/.gitk-tmp.ZEdGpi/1/[2759bf6053e73cb5f7c11c646aee206242db2cd4]
> RemoteTransaction.C
>
> I hope that helps.

I can only guess that the content in those two files are the same.
Which mean the bug is somewhere else. I'm afraid I can't help further
because I'm not familiar with gitk (not even its user for that matter)
-- 
Duy

```
