]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3200-branch.sh
branch: protect branches checked out in all worktrees
[thirdparty/git.git] / t / t3200-branch.sh
index e35e119beeabc58b96bd5f6f10cbd1695db0a868..8a619d785e4f7b031bcf437ca5c80086777e89b8 100755 (executable)
@@ -168,6 +168,13 @@ test_expect_success 'git branch -M foo bar should fail when bar is checked out'
        test_must_fail git branch -M bar foo
 '
 
+test_expect_success 'git branch -M foo bar should fail when bar is checked out in worktree' '
+       git branch -f bar &&
+       test_when_finished "git worktree remove wt && git branch -D wt" &&
+       git worktree add wt &&
+       test_must_fail git branch -M bar wt
+'
+
 test_expect_success 'git branch -M baz bam should succeed when baz is checked out' '
        git checkout -b baz &&
        git branch bam &&