t5300-pack-object: Set up the objects for --strict tests only once.
[git/mingw.git] / t / t2003-checkout-cache-mkdir.sh
blobba1d546c3c359059c764142ac720f821fd558c6a
1 #!/bin/sh
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.
13 . ./test-lib.sh
15 test_expect_success \
16 'setup' \
17 'mkdir path1 &&
18 echo frotz >path0 &&
19 echo rezrov >path1/file1 &&
20 git update-index --add path0 path1/file1'
22 test "$no_symlinks" || {
23 test_expect_success \
24 'have symlink in place where dir is expected.' \
25 'rm -fr path0 path1 &&
26 mkdir path2 &&
27 ln -s path2 path1 &&
28 git checkout-index -f -a &&
29 test ! -h path1 && test -d path1 &&
30 test -f path1/file1 && test ! -f path2/file1'
33 test_expect_success \
34 'use --prefix=path2/' \
35 'rm -fr path0 path1 path2 &&
36 mkdir path2 &&
37 git checkout-index --prefix=path2/ -f -a &&
38 test -f path2/path0 &&
39 test -f path2/path1/file1 &&
40 test ! -f path0 &&
41 test ! -f path1/file1'
43 test_expect_success \
44 'use --prefix=tmp-' \
45 'rm -fr path0 path1 path2 tmp* &&
46 git checkout-index --prefix=tmp- -f -a &&
47 test -f tmp-path0 &&
48 test -f tmp-path1/file1 &&
49 test ! -f path0 &&
50 test ! -f path1/file1'
52 test_expect_success \
53 'use --prefix=tmp- but with a conflicting file and dir' \
54 'rm -fr path0 path1 path2 tmp* &&
55 echo nitfol >tmp-path1 &&
56 mkdir tmp-path0 &&
57 git checkout-index --prefix=tmp- -f -a &&
58 test -f tmp-path0 &&
59 test -f tmp-path1/file1 &&
60 test ! -f path0 &&
61 test ! -f path1/file1'
63 test "$no_symlinks" || {
64 # Linus fix #1
65 test_expect_success \
66 'use --prefix=tmp/orary/ where tmp is a symlink' \
67 'rm -fr path0 path1 path2 tmp* &&
68 mkdir tmp1 tmp1/orary &&
69 ln -s tmp1 tmp &&
70 git checkout-index --prefix=tmp/orary/ -f -a &&
71 test -d tmp1/orary &&
72 test -f tmp1/orary/path0 &&
73 test -f tmp1/orary/path1/file1 &&
74 test -h tmp'
76 # Linus fix #2
77 test_expect_success \
78 'use --prefix=tmp/orary- where tmp is a symlink' \
79 'rm -fr path0 path1 path2 tmp* &&
80 mkdir tmp1 &&
81 ln -s tmp1 tmp &&
82 git checkout-index --prefix=tmp/orary- -f -a &&
83 test -f tmp1/orary-path0 &&
84 test -f tmp1/orary-path1/file1 &&
85 test -h tmp'
87 # Linus fix #3
88 test_expect_success \
89 'use --prefix=tmp- where tmp-path1 is a symlink' \
90 'rm -fr path0 path1 path2 tmp* &&
91 mkdir tmp1 &&
92 ln -s tmp1 tmp-path1 &&
93 git checkout-index --prefix=tmp- -f -a &&
94 test -f tmp-path0 &&
95 test ! -h tmp-path1 &&
96 test -d tmp-path1 &&
97 test -f tmp-path1/file1'
100 test_done