# Worktree "gitdir" file being mangled after upgrade to 2.7.0

6 messages from 2016-01-13 to 2016-01-15. Participants: Erik Johnson, Junio C Hamano, Duy Nguyen, Mike Rappazzo, Andreas Schwab.
Thread: https://gitlist.dev/t/41187

## Erik Johnson, 2016-01-13 23:47

Subject: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <20160113234753.GA26473@gmail.com>
URL: https://gitlist.dev/e/20160113234753.GA26473%40gmail.com

```
Since upgrading to 2.7.0 last week, eventually I'll get to a point when
I run 'git worktree list' where several worktrees are incorrectly
reported as pointing to my main git checkout. Further analysis of the
files in $GIT_DIR/worktrees/worktree_name/ shows that the gitdir file
for the worktrees which display incorrectly contains ".git" instead of
what it should contain (i.e. "/path/to/worktree/.git".

This was reported a couple days ago on Github:

https://github.com/git/git-scm.com/issues/650

Since the audiences for the mailing list and Github don't overlap
completely, I figured I'd report it here to get this issue in front of
as many eyes as possible.

--

-Erik

"For me, it is far better to grasp the universe as it really is than to
persist in delusion, however satisfying and reassuring."  --Carl Sagan


```

## Junio C Hamano, 2016-01-14 02:36

Subject: Re: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <xmqqh9iglwf3.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqh9iglwf3.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20160113234753.GA26473@gmail.com>

```
Erik Johnson <palehose@gmail.com> writes:

> Since upgrading to 2.7.0 last week, eventually I'll get to a point when
> I run 'git worktree list' where several worktrees are incorrectly
> reported as pointing to my main git checkout. Further analysis of the
> files in $GIT_DIR/worktrees/worktree_name/ shows that the gitdir file
> for the worktrees which display incorrectly contains ".git" instead of
> what it should contain (i.e. "/path/to/worktree/.git".
>
> This was reported a couple days ago on Github:
>
> https://github.com/git/git-scm.com/issues/650
>
> Since the audiences for the mailing list and Github don't overlap
> completely, I figured I'd report it here to get this issue in front of
> as many eyes as possible.

Thanks for relaying.  Duy, Michael, I think this is your area?

```

## Duy Nguyen, 2016-01-14 03:29

Subject: Re: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <CACsJy8D2Bz42kvBD1e=0oqxrYDry7_wCOy5Fi3oS-sGJxux4-w@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8D2Bz42kvBD1e%3D0oqxrYDry7_wCOy5Fi3oS-sGJxux4-w%40mail.gmail.com
In-Reply-To: <xmqqh9iglwf3.fsf@gitster.mtv.corp.google.com>

```
On Thu, Jan 14, 2016 at 9:36 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Erik Johnson <palehose@gmail.com> writes:
>
>> Since upgrading to 2.7.0 last week, eventually I'll get to a point when
>> I run 'git worktree list' where several worktrees are incorrectly
>> reported as pointing to my main git checkout. Further analysis of the
>> files in $GIT_DIR/worktrees/worktree_name/ shows that the gitdir file
>> for the worktrees which display incorrectly contains ".git" instead of
>> what it should contain (i.e. "/path/to/worktree/.git".
>>
>> This was reported a couple days ago on Github:
>>
>> https://github.com/git/git-scm.com/issues/650
>>
>> Since the audiences for the mailing list and Github don't overlap
>> completely, I figured I'd report it here to get this issue in front of
>> as many eyes as possible.
>
> Thanks for relaying.  Duy, Michael, I think this is your area?

The only place that a relative pat hcan be written is
update_linked_girdir() unless i'm mistaken. That function is being
deleted "soon" because it causes another problem
-- 
Duy

```

## Mike Rappazzo, 2016-01-14 13:58

Subject: Re: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <CANoM8SUB5hfZHkLenDEq1O1wFrZno1OUUSH2uwDfihC0z+tUkQ@mail.gmail.com>
URL: https://gitlist.dev/e/CANoM8SUB5hfZHkLenDEq1O1wFrZno1OUUSH2uwDfihC0z%2BtUkQ%40mail.gmail.com
In-Reply-To: <CACsJy8D2Bz42kvBD1e=0oqxrYDry7_wCOy5Fi3oS-sGJxux4-w@mail.gmail.com>

```
On Wed, Jan 13, 2016 at 10:29 PM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Thu, Jan 14, 2016 at 9:36 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Erik Johnson <palehose@gmail.com> writes:
>>
>>> Since upgrading to 2.7.0 last week, eventually I'll get to a point when
>>> I run 'git worktree list' where several worktrees are incorrectly
>>> reported as pointing to my main git checkout. Further analysis of the
>>> files in $GIT_DIR/worktrees/worktree_name/ shows that the gitdir file
>>> for the worktrees which display incorrectly contains ".git" instead of
>>> what it should contain (i.e. "/path/to/worktree/.git".
>>>
>>> This was reported a couple days ago on Github:
>>>
>>> https://github.com/git/git-scm.com/issues/650
>>>
>>> Since the audiences for the mailing list and Github don't overlap
>>> completely, I figured I'd report it here to get this issue in front of
>>> as many eyes as possible.
>>
>> Thanks for relaying.  Duy, Michael, I think this is your area?
>
> The only place that a relative path can be written is
> update_linked_girdir() unless i'm mistaken. That function is being
> deleted "soon" because it causes another problem

`git worktree list` command does not modify the worktree gitdir file,
so this is only a symptom of the problem.  If at all possible, we
should move to get Duy's fix into the 2.7.1 release.  This problem
almost makes git worktree list useless.

> --
> Duy

```

## Andreas Schwab, 2016-01-14 18:36

Subject: Re: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <87oaco2eka.fsf@igel.home>
URL: https://gitlist.dev/e/87oaco2eka.fsf%40igel.home
In-Reply-To: <20160113234753.GA26473@gmail.com>

```
Erik Johnson <palehose@gmail.com> writes:

> Since upgrading to 2.7.0 last week, eventually I'll get to a point when
> I run 'git worktree list' where several worktrees are incorrectly
> reported as pointing to my main git checkout. Further analysis of the
> files in $GIT_DIR/worktrees/worktree_name/ shows that the gitdir file
> for the worktrees which display incorrectly contains ".git" instead of
> what it should contain (i.e. "/path/to/worktree/.git".

This always happens to me when I run "git rebase" in a worktree.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

```

## Junio C Hamano, 2016-01-15 17:52

Subject: Re: Worktree "gitdir" file being mangled after upgrade to 2.7.0
Message-ID: <xmqqsi1yivb8.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqsi1yivb8.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CANoM8SUB5hfZHkLenDEq1O1wFrZno1OUUSH2uwDfihC0z+tUkQ@mail.gmail.com>

```
Mike Rappazzo <rappazzo@gmail.com> writes:

>>> Thanks for relaying.  Duy, Michael, I think this is your area?
>>
>> The only place that a relative path can be written is
>> update_linked_girdir() unless i'm mistaken. That function is being
>> deleted "soon" because it causes another problem
>
> `git worktree list` command does not modify the worktree gitdir file,
> so this is only a symptom of the problem.  If at all possible, we
> should move to get Duy's fix into the 2.7.1 release.  This problem
> almost makes git worktree list useless.

Yes, what's the doneness of that "being deleted 'soon'"?

Thanks.

```
