From: Eric Sunshine Date: Sun, 18 Mar 2018 22:59:28 GMT Subject: Re: [PATCH v2 3/3] worktree prune: improve prune logic when worktree is moved Message-ID: In-Reply-To: <20180315164412.14697-4-pclouds@gmail.com> On Thu, Mar 15, 2018 at 12:44 PM, Nguyễn Thái Ngọc Duy wrote: > Automatic detection of worktree relocation by a user (via 'mv', for > instance) was removed by 618244e160 (worktree: stop supporting moving > worktrees manually - 2016-01-22). Prior to that, > .git/worktrees//gitdir was updated whenever the worktree was > accessed in order to let the pruning logic know that the worktree was > "active" even if it disappeared for a while (due to being located on > removable media, for instance). This is my fault since I suggested this rewrite[1], but other documentation calls this , not , so: s/tag/id/ (Again, not worth a re-roll; perhaps Junio can tweak it when queuing.) > "git worktree move" has come so we don't really need this, but since > it's easy to do, perhaps we could keep supporting manual worktree move > a bit longer. Notice that when a worktree is active, the "index" file > should be updated pretty often in common case. The logic is updated to > check for index mtime to see if the worktree is alive. > > The old logic of checking gitdir's mtime is dropped because nobody > updates it anyway. The new corner case is, if the index file does not > exist, we immediately remove the stale worktree. But if the "index" > file does not exist, you may have a bigger problem. Makes sense. > Signed-off-by: Nguyễn Thái Ngọc Duy [1]: https://public-inbox.org/git/CAPig+cQG8yEqunNUjoEAPY-W9+TtzWADhgjdL6udnyrG0YEOVg@mail.gmail.com/