blob: e6f59f1914667f0001fe990656a66bb76e14a41d [file] [log] [blame]
Junio C Hamanoec0603e2007-07-12 01:04:16 -07001#!/bin/sh
2#
3# Copyright (c) 2007 Junio C Hamano
4
5test_description='git checkout to switch between branches with symlink<->dir'
6
7. ./test-lib.sh
8
Ævar Arnfjörð Bjarmason41be8ea2010-07-28 10:34:55 +00009test_expect_success SYMLINKS setup '
Junio C Hamanoec0603e2007-07-12 01:04:16 -070010
11 mkdir frotz &&
12 echo hello >frotz/filfre &&
13 git add frotz/filfre &&
14 test_tick &&
15 git commit -m "master has file frotz/filfre" &&
16
17 git branch side &&
18
19 echo goodbye >nitfol &&
Jonathan Niedera48fcd82010-10-30 20:46:54 -050020 git add nitfol &&
Junio C Hamanoec0603e2007-07-12 01:04:16 -070021 test_tick &&
22 git commit -m "master adds file nitfol" &&
23
24 git checkout side &&
25
26 git rm --cached frotz/filfre &&
27 mv frotz xyzzy &&
28 ln -s xyzzy frotz &&
29 git add xyzzy/filfre frotz &&
30 test_tick &&
31 git commit -m "side moves frotz/ to xyzzy/ and adds frotz->xyzzy/"
32
33'
34
Ævar Arnfjörð Bjarmason41be8ea2010-07-28 10:34:55 +000035test_expect_success SYMLINKS 'switch from symlink to dir' '
Junio C Hamanoec0603e2007-07-12 01:04:16 -070036
37 git checkout master
38
39'
40
Ævar Arnfjörð Bjarmason41be8ea2010-07-28 10:34:55 +000041test_expect_success SYMLINKS 'Remove temporary directories & switch to master' '
Ævar Arnfjörð Bjarmason621fd7a2010-05-07 19:37:03 +000042 rm -fr frotz xyzzy nitfol &&
43 git checkout -f master
44'
Junio C Hamanoec0603e2007-07-12 01:04:16 -070045
Ævar Arnfjörð Bjarmason41be8ea2010-07-28 10:34:55 +000046test_expect_success SYMLINKS 'switch from dir to symlink' '
Junio C Hamanoec0603e2007-07-12 01:04:16 -070047
48 git checkout side
49
50'
51
52test_done