Merge branch 'rs/branch-allow-deleting-dangling' into maint
[git/debian.git] / t / t2007-checkout-symlink.sh
blob6f0b90ce1271ec49f6fd78016c5f3cb082053674
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-lib.sh
12 test_expect_success setup '
14 mkdir frotz &&
15 echo hello >frotz/filfre &&
16 git add frotz/filfre &&
17 test_tick &&
18 git commit -m "main has file frotz/filfre" &&
20 git branch side &&
22 echo goodbye >nitfol &&
23 git add nitfol &&
24 test_tick &&
25 git commit -m "main adds file nitfol" &&
27 git checkout side &&
29 git rm --cached frotz/filfre &&
30 mv frotz xyzzy &&
31 test_ln_s_add xyzzy frotz &&
32 git add xyzzy/filfre &&
33 test_tick &&
34 git commit -m "side moves frotz/ to xyzzy/ and adds frotz->xyzzy/"
38 test_expect_success 'switch from symlink to dir' '
40 git checkout main
44 test_expect_success 'Remove temporary directories & switch to main' '
45 rm -fr frotz xyzzy nitfol &&
46 git checkout -f main
49 test_expect_success 'switch from dir to symlink' '
51 git checkout side
55 test_done