Re: [PATCH] worktree add: be tolerant of corrupt worktrees
- Date: Fri, 17 May 2019 03:46:26 -0400
- From: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
- Subject: Re: [PATCH] worktree add: be tolerant of corrupt worktrees
On Mon, May 13, 2019 at 6:50 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
> find_worktree() can die() unexpectedly because it uses real_path()
> instead of the gentler version. When it's used in 'git worktree add' 
> and there's a bad worktree, this die() could prevent people from adding
> new worktrees.
This is good to know because, to fix , I think we'll want to add a
new function akin to find_worktree(), but without magic suffix
matching (that is, just literal absolute path comparison).
> The "bad" condition to trigger this is when a parent of the worktree's
> location is deleted. Then real_path() will complain.
> Use the other version so that bad worktrees won't affect 'worktree
> add'. The bad ones will eventually be pruned, we just have to tolerate
> them for a bit.
The patch itself makes sense, though, as Shaheed noted in his
response, pruning seems to get short-circuited somehow under this
situation; perhaps that needs its own fix, but certainly shouldn't
hold up this fix.
> Reported-by: Shaheed Haque <shaheedhaque@xxxxxxxxx>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>