# Re: Bug in "revision.c: --all adds HEAD from all worktrees" ?

2 messages from 2018-03-13 to 2018-03-13. Participants: Stan Hu, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/48034

## Stan Hu, 2018-03-13 18:23

Subject: Re: Bug in "revision.c: --all adds HEAD from all worktrees" ?
Message-ID: <C62FA8BB-FDCA-4BD0-A029-74C7AB89441F@gmail.com>
URL: https://gitlist.dev/e/C62FA8BB-FDCA-4BD0-A029-74C7AB89441F%40gmail.com

```
To be clear, this is how I think we got into this state:

We have worktrees that are created to squash and rebase a branch. They were left around inadvertently for one reason or another.

Since we were using git v2.14.3, a git gc would prune dangling objects because it never saw that a worktree still had a reference to it. Now, in git v2.15+, worktrees are examined, and a git gc won't garbage collect any objects referenced by a worktree.

Another words, the failure of git v2.14 to preserve these objects caused problems with these stale worktrees with the upgrade to v2.15+.


```

## Ævar Arnfjörð Bjarmason, 2018-03-13 20:29

Subject: Re: Bug in "revision.c: --all adds HEAD from all worktrees" ?
Message-ID: <874lljg1ns.fsf@evledraar.gmail.com>
URL: https://gitlist.dev/e/874lljg1ns.fsf%40evledraar.gmail.com
In-Reply-To: <C62FA8BB-FDCA-4BD0-A029-74C7AB89441F@gmail.com>

```

On Tue, Mar 13 2018, Stan Hu jotted:

> To be clear, this is how I think we got into this state:
>
> We have worktrees that are created to squash and rebase a branch. They were left around inadvertently for one reason or another.
>
> Since we were using git v2.14.3, a git gc would prune dangling objects because it never saw that a worktree still had a reference to it. Now, in git v2.15+, worktrees are examined, and a git gc won't garbage collect any objects referenced by a worktree.
>
> Another words, the failure of git v2.14 to preserve these objects caused problems with these stale worktrees with the upgrade to v2.15+.

Thanks, I hadn't dug into the root cause. Good to know it's not some
failure mode we're still producing, just the result of past bugs.

```
