| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Junio C Hamano |
| 4 | |
| 5 | test_description='git checkout to switch between branches with symlink<->dir' |
| 6 | |
| 7 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
| 8 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
| 9 | |
| 10 | . ./test-lib.sh |
| 11 | |
| 12 | test_expect_success setup ' |
| 13 | |
| 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" && |
| 19 | |
| 20 | git branch side && |
| 21 | |
| 22 | echo goodbye >nitfol && |
| 23 | git add nitfol && |
| 24 | test_tick && |
| 25 | git commit -m "main adds file nitfol" && |
| 26 | |
| 27 | git checkout side && |
| 28 | |
| 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/" |
| 35 | |
| 36 | ' |
| 37 | |
| 38 | test_expect_success 'switch from symlink to dir' ' |
| 39 | |
| 40 | git checkout main |
| 41 | |
| 42 | ' |
| 43 | |
| 44 | test_expect_success 'Remove temporary directories & switch to main' ' |
| 45 | rm -fr frotz xyzzy nitfol && |
| 46 | git checkout -f main |
| 47 | ' |
| 48 | |
| 49 | test_expect_success 'switch from dir to symlink' ' |
| 50 | |
| 51 | git checkout side |
| 52 | |
| 53 | ' |
| 54 | |
| 55 | test_done |