Merge branch 'ss/rename-tests'
[gitweb.git] / t / t2028-worktree-move.sh
index 9756ede8f1527de7a92a44470d2c949b6e5d663d..33c033773367a135d4cb7eb23f9e9d3131197174 100755 (executable)
@@ -163,4 +163,26 @@ test_expect_success 'proper error when worktree not found' '
        done
 '
 
+test_expect_success 'remove locked worktree (force)' '
+       git worktree add --detach gumby &&
+       test_when_finished "git worktree remove gumby || :" &&
+       git worktree lock gumby &&
+       test_when_finished "git worktree unlock gumby || :" &&
+       test_must_fail git worktree remove gumby &&
+       test_must_fail git worktree remove --force gumby &&
+       git worktree remove --force --force gumby
+'
+
+test_expect_success 'remove cleans up .git/worktrees when empty' '
+       git init moog &&
+       (
+               cd moog &&
+               test_commit bim &&
+               git worktree add --detach goom &&
+               test_path_exists .git/worktrees &&
+               git worktree remove goom &&
+               test_path_is_missing .git/worktrees
+       )
+'
+
 test_done