refs/files: skip creation of "refs/{heads,tags}" for worktrees
[git.git] / t / t2007-checkout-symlink.sh
blobbd9e9e7530da06da9eb3fc6ce103b82196625d23
1 #!/bin/sh
3 # Copyright (c) 2007 Junio C Hamano
5 test_description='git checkout to switch between branches with symlink<->dir'
7 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10 TEST_PASSES_SANITIZE_LEAK=true
11 . ./test-lib.sh
13 test_expect_success setup '
15 mkdir frotz &&
16 echo hello >frotz/filfre &&
17 git add frotz/filfre &&
18 test_tick &&
19 git commit -m "main has file frotz/filfre" &&
21 git branch side &&
23 echo goodbye >nitfol &&
24 git add nitfol &&
25 test_tick &&
26 git commit -m "main adds file nitfol" &&
28 git checkout side &&
30 git rm --cached frotz/filfre &&
31 mv frotz xyzzy &&
32 test_ln_s_add xyzzy frotz &&
33 git add xyzzy/filfre &&
34 test_tick &&
35 git commit -m "side moves frotz/ to xyzzy/ and adds frotz->xyzzy/"
39 test_expect_success 'switch from symlink to dir' '
41 git checkout main
45 test_expect_success 'Remove temporary directories & switch to main' '
46 rm -fr frotz xyzzy nitfol &&
47 git checkout -f main
50 test_expect_success 'switch from dir to symlink' '
52 git checkout side
56 test_done