t9100,t3419: enclose all test code in single-quotes
[gitweb.git] / t / t2025-worktree-add.sh
index a4d36c0892db686a7677cf1ab23a9f8ed81859eb..3acb9926f2ff7fbf2b367a089b294a4a88e2ea31 100755 (executable)
@@ -193,6 +193,13 @@ test_expect_success '"add" -B/--detach mutually exclusive' '
        test_must_fail git worktree add -B poodle --detach bamboo master
 '
 
+test_expect_success '"add -B" fails if the branch is checked out' '
+       git rev-parse newmaster >before &&
+       test_must_fail git worktree add -B newmaster bamboo master &&
+       git rev-parse newmaster >after &&
+       test_cmp before after
+'
+
 test_expect_success 'add -B' '
        git worktree add -B poodle bamboo2 master^ &&
        git -C bamboo2 symbolic-ref HEAD >actual &&
@@ -206,4 +213,16 @@ test_expect_success 'local clone from linked checkout' '
        ( cd here-clone && git fsck )
 '
 
+test_expect_success '"add" worktree with --no-checkout' '
+       git worktree add --no-checkout -b swamp swamp &&
+       ! test -e swamp/init.t &&
+       git -C swamp reset --hard &&
+       test_cmp init.t swamp/init.t
+'
+
+test_expect_success '"add" worktree with --checkout' '
+       git worktree add --checkout -b swmap2 swamp2 &&
+       test_cmp init.t swamp2/init.t
+'
+
 test_done