Merge branch 'nd/worktree-add-lock'

Allow to lock a worktree immediately after it's created. This helps
prevent a race between "git worktree add; git worktree lock" and
"git worktree prune".

* nd/worktree-add-lock:
  worktree add: add --lock option
This commit is contained in:
Junio C Hamano
2017-04-26 15:39:12 +09:00
3 changed files with 23 additions and 5 deletions

View File

@ -63,6 +63,12 @@ test_expect_success '"add" worktree' '
)
'
test_expect_success '"add" worktree with lock' '
git rev-parse HEAD >expect &&
git worktree add --detach --lock here-with-lock master &&
test -f .git/worktrees/here-with-lock/locked
'
test_expect_success '"add" worktree from a subdir' '
(
mkdir sub &&