3 test_description
='test git checkout --to'
7 test_expect_success
'setup' '
11 test_expect_success
'checkout --to not updating paths' '
12 test_must_fail git checkout --to -- init.t
15 test_expect_success
'checkout --to an existing worktree' '
17 test_must_fail git checkout --detach --to existing master
20 test_expect_success
'checkout --to a new worktree' '
21 git checkout --to here master &&
24 test_cmp ../init.t init.t &&
25 git symbolic-ref HEAD >actual &&
26 echo refs/heads/master >expect &&
27 test_cmp expect actual &&
32 test_expect_success
'checkout --to a new worktree from a subdir' '
36 git checkout --detach --to here master &&
38 test_cmp ../../init.t init.t
42 test_expect_success
'checkout --to from a linked checkout' '
45 git checkout --to nested-here master &&
51 test_expect_success
'checkout --to a new worktree creating new branch' '
52 git checkout --to there -b newmaster master &&
55 test_cmp ../init.t init.t &&
56 git symbolic-ref HEAD >actual &&
57 echo refs/heads/newmaster >expect &&
58 test_cmp expect actual &&