2005-05-24 08:51:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Junio C Hamano
|
|
|
|
#
|
|
|
|
|
2007-07-03 05:52:14 +00:00
|
|
|
test_description='git checkout-index --prefix test.
|
2005-05-24 08:51:27 +00:00
|
|
|
|
|
|
|
This test makes sure that --prefix option works as advertised, and
|
|
|
|
also verifies that such leading path may contain symlinks, unlike
|
|
|
|
the GIT controlled paths.
|
|
|
|
'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'setup' \
|
|
|
|
'mkdir path1 &&
|
|
|
|
echo frotz >path0 &&
|
|
|
|
echo rezrov >path1/file1 &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git update-index --add path0 path1/file1'
|
2005-05-24 08:51:27 +00:00
|
|
|
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS \
|
2005-05-24 08:51:27 +00:00
|
|
|
'have symlink in place where dir is expected.' \
|
|
|
|
'rm -fr path0 path1 &&
|
|
|
|
mkdir path2 &&
|
|
|
|
ln -s path2 path1 &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test ! -h path1 && test -d path1 &&
|
|
|
|
test -f path1/file1 && test ! -f path2/file1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'use --prefix=path2/' \
|
|
|
|
'rm -fr path0 path1 path2 &&
|
|
|
|
mkdir path2 &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=path2/ -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -f path2/path0 &&
|
|
|
|
test -f path2/path1/file1 &&
|
|
|
|
test ! -f path0 &&
|
|
|
|
test ! -f path1/file1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'use --prefix=tmp-' \
|
|
|
|
'rm -fr path0 path1 path2 tmp* &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=tmp- -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -f tmp-path0 &&
|
|
|
|
test -f tmp-path1/file1 &&
|
|
|
|
test ! -f path0 &&
|
|
|
|
test ! -f path1/file1'
|
|
|
|
|
|
|
|
test_expect_success \
|
|
|
|
'use --prefix=tmp- but with a conflicting file and dir' \
|
|
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
|
|
echo nitfol >tmp-path1 &&
|
|
|
|
mkdir tmp-path0 &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=tmp- -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -f tmp-path0 &&
|
|
|
|
test -f tmp-path1/file1 &&
|
|
|
|
test ! -f path0 &&
|
|
|
|
test ! -f path1/file1'
|
|
|
|
|
|
|
|
# Linus fix #1
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS \
|
2005-05-24 08:51:27 +00:00
|
|
|
'use --prefix=tmp/orary/ where tmp is a symlink' \
|
|
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
|
|
mkdir tmp1 tmp1/orary &&
|
|
|
|
ln -s tmp1 tmp &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=tmp/orary/ -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -d tmp1/orary &&
|
|
|
|
test -f tmp1/orary/path0 &&
|
|
|
|
test -f tmp1/orary/path1/file1 &&
|
|
|
|
test -h tmp'
|
|
|
|
|
|
|
|
# Linus fix #2
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS \
|
2005-05-24 08:51:27 +00:00
|
|
|
'use --prefix=tmp/orary- where tmp is a symlink' \
|
|
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
|
|
mkdir tmp1 &&
|
|
|
|
ln -s tmp1 tmp &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=tmp/orary- -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -f tmp1/orary-path0 &&
|
|
|
|
test -f tmp1/orary-path1/file1 &&
|
|
|
|
test -h tmp'
|
|
|
|
|
|
|
|
# Linus fix #3
|
2009-03-04 21:38:24 +00:00
|
|
|
test_expect_success SYMLINKS \
|
2005-05-24 08:51:27 +00:00
|
|
|
'use --prefix=tmp- where tmp-path1 is a symlink' \
|
|
|
|
'rm -fr path0 path1 path2 tmp* &&
|
|
|
|
mkdir tmp1 &&
|
|
|
|
ln -s tmp1 tmp-path1 &&
|
2007-07-03 05:52:14 +00:00
|
|
|
git checkout-index --prefix=tmp- -f -a &&
|
2005-05-24 08:51:27 +00:00
|
|
|
test -f tmp-path0 &&
|
|
|
|
test ! -h tmp-path1 &&
|
|
|
|
test -d tmp-path1 &&
|
|
|
|
test -f tmp-path1/file1'
|
|
|
|
|
2005-08-11 02:15:02 +00:00
|
|
|
test_done
|