]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2007-checkout-symlink.sh
The third batch
[thirdparty/git.git] / t / t2007-checkout-symlink.sh
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_PASSES_SANITIZE_LEAK=true
11 . ./test-lib.sh
12
13 test_expect_success setup '
14
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" &&
20
21 git branch side &&
22
23 echo goodbye >nitfol &&
24 git add nitfol &&
25 test_tick &&
26 git commit -m "main adds file nitfol" &&
27
28 git checkout side &&
29
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/"
36
37 '
38
39 test_expect_success 'switch from symlink to dir' '
40
41 git checkout main
42
43 '
44
45 test_expect_success 'Remove temporary directories & switch to main' '
46 rm -fr frotz xyzzy nitfol &&
47 git checkout -f main
48 '
49
50 test_expect_success 'switch from dir to symlink' '
51
52 git checkout side
53
54 '
55
56 test_done