diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-04-12 20:58:05 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-20 17:59:02 -0700 |
commit | 507e6e9eecce5e7a2cc204c844bbb2f9b17b31e3 (patch) | |
tree | d90d7b0ab97c2e5e8cd288f83111f6a0364d2ea2 /t | |
parent | Eleventh batch for 2.13 (diff) | |
download | tgif-507e6e9eecce5e7a2cc204c844bbb2f9b17b31e3.tar.xz |
worktree add: add --lock option
As explained in the document. This option has an advantage over the
command sequence "git worktree add && git worktree lock": there will be
no gap that somebody can accidentally "prune" the new worktree (or soon,
explicitly "worktree remove" it).
"worktree add" does keep a lock on while it's preparing the worktree.
If --lock is specified, this lock remains after the worktree is created.
Suggested-by: David Taylor <David.Taylor@dell.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t2025-worktree-add.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh index b618d6be21..b5c47ac602 100755 --- a/t/t2025-worktree-add.sh +++ b/t/t2025-worktree-add.sh @@ -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 && |