t2003: modernize style
[git/jnareb-git.git] / t / t2003-checkout-cache-mkdir.sh
blob63fd0a883542ac8c1caf34b9b860ffd22639367f
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 'setup' '
16 mkdir path1 &&
17 echo frotz >path0 &&
18 echo rezrov >path1/file1 &&
19 git update-index --add path0 path1/file1
22 test_expect_success SYMLINKS 'have symlink in place where dir is expected.' '
23 rm -fr path0 path1 &&
24 mkdir path2 &&
25 ln -s path2 path1 &&
26 git checkout-index -f -a &&
27 test ! -h path1 && test -d path1 &&
28 test -f path1/file1 && test ! -f path2/file1
31 test_expect_success 'use --prefix=path2/' '
32 rm -fr path0 path1 path2 &&
33 mkdir path2 &&
34 git checkout-index --prefix=path2/ -f -a &&
35 test -f path2/path0 &&
36 test -f path2/path1/file1 &&
37 test ! -f path0 &&
38 test ! -f path1/file1
41 test_expect_success 'use --prefix=tmp-' '
42 rm -fr path0 path1 path2 tmp* &&
43 git checkout-index --prefix=tmp- -f -a &&
44 test -f tmp-path0 &&
45 test -f tmp-path1/file1 &&
46 test ! -f path0 &&
47 test ! -f path1/file1
50 test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '
51 rm -fr path0 path1 path2 tmp* &&
52 echo nitfol >tmp-path1 &&
53 mkdir tmp-path0 &&
54 git checkout-index --prefix=tmp- -f -a &&
55 test -f tmp-path0 &&
56 test -f tmp-path1/file1 &&
57 test ! -f path0 &&
58 test ! -f path1/file1
61 test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '
62 rm -fr path0 path1 path2 tmp* &&
63 mkdir tmp1 tmp1/orary &&
64 ln -s tmp1 tmp &&
65 git checkout-index --prefix=tmp/orary/ -f -a &&
66 test -d tmp1/orary &&
67 test -f tmp1/orary/path0 &&
68 test -f tmp1/orary/path1/file1 &&
69 test -h tmp
72 test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '
73 rm -fr path0 path1 path2 tmp* &&
74 mkdir tmp1 &&
75 ln -s tmp1 tmp &&
76 git checkout-index --prefix=tmp/orary- -f -a &&
77 test -f tmp1/orary-path0 &&
78 test -f tmp1/orary-path1/file1 &&
79 test -h tmp
82 test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '
83 rm -fr path0 path1 path2 tmp* &&
84 mkdir tmp1 &&
85 ln -s tmp1 tmp-path1 &&
86 git checkout-index --prefix=tmp- -f -a &&
87 test -f tmp-path0 &&
88 test ! -h tmp-path1 &&
89 test -d tmp-path1 &&
90 test -f tmp-path1/file1
93 test_done