3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='git checkout-index --prefix test.
8 This test makes sure that --prefix option works as advertised, and
9 also verifies that such leading path may contain symlinks, unlike
10 the GIT controlled paths.
19 echo rezrov >path1/file1 &&
20 git update-index --add path0 path1/file1'
22 test "$no_symlinks" ||
{
24 'have symlink in place where dir is expected.' \
25 'rm -fr path0 path1 &&
28 git checkout-index -f -a &&
29 test ! -h path1 && test -d path1 &&
30 test -f path1/file1 && test ! -f path2/file1'
34 'use --prefix=path2/' \
35 'rm -fr path0 path1 path2 &&
37 git checkout-index --prefix=path2/ -f -a &&
38 test -f path2/path0 &&
39 test -f path2/path1/file1 &&
41 test ! -f path1/file1'
45 'rm -fr path0 path1 path2 tmp* &&
46 git checkout-index --prefix=tmp- -f -a &&
48 test -f tmp-path1/file1 &&
50 test ! -f path1/file1'
53 'use --prefix=tmp- but with a conflicting file and dir' \
54 'rm -fr path0 path1 path2 tmp* &&
55 echo nitfol >tmp-path1 &&
57 git checkout-index --prefix=tmp- -f -a &&
59 test -f tmp-path1/file1 &&
61 test ! -f path1/file1'
63 test "$no_symlinks" ||
{
66 'use --prefix=tmp/orary/ where tmp is a symlink' \
67 'rm -fr path0 path1 path2 tmp* &&
68 mkdir tmp1 tmp1/orary &&
70 git checkout-index --prefix=tmp/orary/ -f -a &&
72 test -f tmp1/orary/path0 &&
73 test -f tmp1/orary/path1/file1 &&
78 'use --prefix=tmp/orary- where tmp is a symlink' \
79 'rm -fr path0 path1 path2 tmp* &&
82 git checkout-index --prefix=tmp/orary- -f -a &&
83 test -f tmp1/orary-path0 &&
84 test -f tmp1/orary-path1/file1 &&
89 'use --prefix=tmp- where tmp-path1 is a symlink' \
90 'rm -fr path0 path1 path2 tmp* &&
92 ln -s tmp1 tmp-path1 &&
93 git checkout-index --prefix=tmp- -f -a &&
95 test ! -h tmp-path1 &&
97 test -f tmp-path1/file1'