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

2019-02-20 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

[PATCH v3 2/2] setup: don't fail if commondir reference is deleted.

2019-02-20 Thread Michal Suchanek
happnes git aborts failing to perform perfectly valid command because unrelated worktree is not yet fully initialized. Rather than testing if the file exists before reading it handle ENOENT and ENOTDIR. Signed-off-by: Michal Suchanek --- v2: - do not test file existence first, just read it and

[PATCH 0/2] worktree add race fix

2019-02-18 Thread Michal Suchanek
...@mail.gmail.com/ Michal Suchanek (2): worktree: fix worktree add race. setup: don't fail if commondir reference is deleted. builtin/worktree.c | 12 +++- setup.c| 16 +++- 2 files changed, 18 insertions(+), 10 deletions(-) -- 2.20.1

[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

[PATCH 2/2] setup: don't fail if commondir reference is deleted.

2019-02-18 Thread Michal Suchanek
When adding wotktrees git can die in get_common_dir_noenv while examining existing worktrees because the commondir file does not exist. Rather than testing if the file exists before reading it handle ENOENT. Signed-off-by: Michal Suchanek --- v2: - do not test file existence first, just read it

[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

[PATCH 2/2] setup: don't fail if commondir is deleted.

2019-02-15 Thread Michal Suchanek
When adding wotktrees git can die in get_common_dir_noenv while examining existing worktrees because the commondir file does not exist. Handle ENOENT so adding a worktree does not fail because of incompletely set-up other worktree. Signed-off-by: Michal Suchanek --- setup.c | 33