[PATCH 1/2] worktree: fix worktree add race.

2019-02-18 Thread Michal Suchanek
Git runs a stat loop to find a worktree name that's available and then does mkdir on the found name. Turn it to mkdir loop to avoid another invocation of worktree add finding the same free name and creating the directory first. Signed-off-by: Michal Suchanek --- v2: - simplify loop exit condition

Re: [PATCH 1/2] worktree: fix worktree add race.

2019-02-16 Thread Eric Sunshine
On Fri, Feb 15, 2019 at 1:59 PM Junio C Hamano wrote: > Michal Suchanek writes: > > Git runs a stat loop to find a worktree name that's available and then does > > mkdir on the found name. Turn it to mkdir loop to avoid another invocation > > of > > worktree add finding the same free name and cr

Re: [PATCH 1/2] worktree: fix worktree add race.

2019-02-15 Thread Michal Suchánek
On Fri, 15 Feb 2019 10:59:33 -0800 Junio C Hamano wrote: > Michal Suchanek writes: > > > Git runs a stat loop to find a worktree name that's available and then does > > mkdir on the found name. Turn it to mkdir loop to avoid another invocation > > of > > worktree add finding the same free name

Re: [PATCH 1/2] worktree: fix worktree add race.

2019-02-15 Thread Junio C Hamano
Michal Suchanek writes: > Git runs a stat loop to find a worktree name that's available and then does > mkdir on the found name. Turn it to mkdir loop to avoid another invocation of > worktree add finding the same free name and creating the directory first. Yeah, relying on the atomicity of mkdi

[PATCH 1/2] worktree: fix worktree add race.

2019-02-15 Thread Michal Suchanek
Git runs a stat loop to find a worktree name that's available and then does mkdir on the found name. Turn it to mkdir loop to avoid another invocation of worktree add finding the same free name and creating the directory first. Signed-off-by: Michal Suchanek --- builtin/worktree.c | 11 ++---