]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2007-checkout-symlink.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t2007-checkout-symlink.sh
CommitLineData
ec0603e1
JH
1#!/bin/sh
2#
3# Copyright (c) 2007 Junio C Hamano
4
5test_description='git checkout to switch between branches with symlink<->dir'
6
883b98ef 7GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
8export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9
9081a421 10TEST_PASSES_SANITIZE_LEAK=true
ec0603e1
JH
11. ./test-lib.sh
12
889c6f0e 13test_expect_success setup '
ec0603e1
JH
14
15 mkdir frotz &&
16 echo hello >frotz/filfre &&
17 git add frotz/filfre &&
18 test_tick &&
883b98ef 19 git commit -m "main has file frotz/filfre" &&
ec0603e1
JH
20
21 git branch side &&
22
23 echo goodbye >nitfol &&
a48fcd83 24 git add nitfol &&
ec0603e1 25 test_tick &&
883b98ef 26 git commit -m "main adds file nitfol" &&
ec0603e1
JH
27
28 git checkout side &&
29
30 git rm --cached frotz/filfre &&
31 mv frotz xyzzy &&
889c6f0e
JS
32 test_ln_s_add xyzzy frotz &&
33 git add xyzzy/filfre &&
ec0603e1
JH
34 test_tick &&
35 git commit -m "side moves frotz/ to xyzzy/ and adds frotz->xyzzy/"
36
37'
38
889c6f0e 39test_expect_success 'switch from symlink to dir' '
ec0603e1 40
883b98ef 41 git checkout main
ec0603e1
JH
42
43'
44
883b98ef 45test_expect_success 'Remove temporary directories & switch to main' '
621fd7a2 46 rm -fr frotz xyzzy nitfol &&
883b98ef 47 git checkout -f main
621fd7a2 48'
ec0603e1 49
889c6f0e 50test_expect_success 'switch from dir to symlink' '
ec0603e1
JH
51
52 git checkout side
53
54'
55
56test_done