about summary refs log tree commit diff
path: root/third_party/git/t/t2403-worktree-move.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/t2403-worktree-move.sh')
-rwxr-xr-xthird_party/git/t/t2403-worktree-move.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/third_party/git/t/t2403-worktree-move.sh b/third_party/git/t/t2403-worktree-move.sh
index 939d18d728..a4e1a178e0 100755
--- a/third_party/git/t/t2403-worktree-move.sh
+++ b/third_party/git/t/t2403-worktree-move.sh
@@ -112,6 +112,27 @@ test_expect_success 'move locked worktree (force)' '
 	git worktree move --force --force flump ploof
 '
 
+test_expect_success 'refuse to move worktree atop existing path' '
+	>bobble &&
+	git worktree add --detach beeble &&
+	test_must_fail git worktree move beeble bobble
+'
+
+test_expect_success 'move atop existing but missing worktree' '
+	git worktree add --detach gnoo &&
+	git worktree add --detach pneu &&
+	rm -fr pneu &&
+	test_must_fail git worktree move gnoo pneu &&
+	git worktree move --force gnoo pneu &&
+
+	git worktree add --detach nu &&
+	git worktree lock nu &&
+	rm -fr nu &&
+	test_must_fail git worktree move pneu nu &&
+	test_must_fail git worktree --force move pneu nu &&
+	git worktree move --force --force pneu nu
+'
+
 test_expect_success 'move a repo with uninitialized submodule' '
 	git init withsub &&
 	(