Merge branch 'jk/checkout-attribute-lookup' into maint-1.8.1
* jk/checkout-attribute-lookup: t2003: work around path mangling issue on Windows entry: fix filter lookup t2003: modernize style
This commit is contained in:
commit
67ff3d27f6
2
entry.c
2
entry.c
@ -145,7 +145,7 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (ce_mode_s_ifmt == S_IFREG) {
|
if (ce_mode_s_ifmt == S_IFREG) {
|
||||||
struct stream_filter *filter = get_stream_filter(path, ce->sha1);
|
struct stream_filter *filter = get_stream_filter(ce->name, ce->sha1);
|
||||||
if (filter &&
|
if (filter &&
|
||||||
!streaming_write_entry(ce, path, filter,
|
!streaming_write_entry(ce, path, filter,
|
||||||
state, to_tempfile,
|
state, to_tempfile,
|
||||||
|
@ -12,85 +12,108 @@ the GIT controlled paths.
|
|||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success 'setup' '
|
||||||
'setup' \
|
mkdir path1 &&
|
||||||
'mkdir path1 &&
|
echo frotz >path0 &&
|
||||||
echo frotz >path0 &&
|
echo rezrov >path1/file1 &&
|
||||||
echo rezrov >path1/file1 &&
|
git update-index --add path0 path1/file1
|
||||||
git update-index --add path0 path1/file1'
|
'
|
||||||
|
|
||||||
test_expect_success SYMLINKS \
|
test_expect_success SYMLINKS 'have symlink in place where dir is expected.' '
|
||||||
'have symlink in place where dir is expected.' \
|
rm -fr path0 path1 &&
|
||||||
'rm -fr path0 path1 &&
|
mkdir path2 &&
|
||||||
mkdir path2 &&
|
ln -s path2 path1 &&
|
||||||
ln -s path2 path1 &&
|
git checkout-index -f -a &&
|
||||||
git checkout-index -f -a &&
|
test ! -h path1 && test -d path1 &&
|
||||||
test ! -h path1 && test -d path1 &&
|
test -f path1/file1 && test ! -f path2/file1
|
||||||
test -f path1/file1 && test ! -f path2/file1'
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success 'use --prefix=path2/' '
|
||||||
'use --prefix=path2/' \
|
rm -fr path0 path1 path2 &&
|
||||||
'rm -fr path0 path1 path2 &&
|
mkdir path2 &&
|
||||||
mkdir path2 &&
|
git checkout-index --prefix=path2/ -f -a &&
|
||||||
git checkout-index --prefix=path2/ -f -a &&
|
test -f path2/path0 &&
|
||||||
test -f path2/path0 &&
|
test -f path2/path1/file1 &&
|
||||||
test -f path2/path1/file1 &&
|
test ! -f path0 &&
|
||||||
test ! -f path0 &&
|
test ! -f path1/file1
|
||||||
test ! -f path1/file1'
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success 'use --prefix=tmp-' '
|
||||||
'use --prefix=tmp-' \
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
'rm -fr path0 path1 path2 tmp* &&
|
git checkout-index --prefix=tmp- -f -a &&
|
||||||
git checkout-index --prefix=tmp- -f -a &&
|
test -f tmp-path0 &&
|
||||||
test -f tmp-path0 &&
|
test -f tmp-path1/file1 &&
|
||||||
test -f tmp-path1/file1 &&
|
test ! -f path0 &&
|
||||||
test ! -f path0 &&
|
test ! -f path1/file1
|
||||||
test ! -f path1/file1'
|
'
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '
|
||||||
'use --prefix=tmp- but with a conflicting file and dir' \
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
'rm -fr path0 path1 path2 tmp* &&
|
echo nitfol >tmp-path1 &&
|
||||||
echo nitfol >tmp-path1 &&
|
mkdir tmp-path0 &&
|
||||||
mkdir tmp-path0 &&
|
git checkout-index --prefix=tmp- -f -a &&
|
||||||
git checkout-index --prefix=tmp- -f -a &&
|
test -f tmp-path0 &&
|
||||||
test -f tmp-path0 &&
|
test -f tmp-path1/file1 &&
|
||||||
test -f tmp-path1/file1 &&
|
test ! -f path0 &&
|
||||||
test ! -f path0 &&
|
test ! -f path1/file1
|
||||||
test ! -f path1/file1'
|
'
|
||||||
|
|
||||||
# Linus fix #1
|
test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '
|
||||||
test_expect_success SYMLINKS \
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
'use --prefix=tmp/orary/ where tmp is a symlink' \
|
mkdir tmp1 tmp1/orary &&
|
||||||
'rm -fr path0 path1 path2 tmp* &&
|
ln -s tmp1 tmp &&
|
||||||
mkdir tmp1 tmp1/orary &&
|
git checkout-index --prefix=tmp/orary/ -f -a &&
|
||||||
ln -s tmp1 tmp &&
|
test -d tmp1/orary &&
|
||||||
git checkout-index --prefix=tmp/orary/ -f -a &&
|
test -f tmp1/orary/path0 &&
|
||||||
test -d tmp1/orary &&
|
test -f tmp1/orary/path1/file1 &&
|
||||||
test -f tmp1/orary/path0 &&
|
test -h tmp
|
||||||
test -f tmp1/orary/path1/file1 &&
|
'
|
||||||
test -h tmp'
|
|
||||||
|
|
||||||
# Linus fix #2
|
test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '
|
||||||
test_expect_success SYMLINKS \
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
'use --prefix=tmp/orary- where tmp is a symlink' \
|
mkdir tmp1 &&
|
||||||
'rm -fr path0 path1 path2 tmp* &&
|
ln -s tmp1 tmp &&
|
||||||
mkdir tmp1 &&
|
git checkout-index --prefix=tmp/orary- -f -a &&
|
||||||
ln -s tmp1 tmp &&
|
test -f tmp1/orary-path0 &&
|
||||||
git checkout-index --prefix=tmp/orary- -f -a &&
|
test -f tmp1/orary-path1/file1 &&
|
||||||
test -f tmp1/orary-path0 &&
|
test -h tmp
|
||||||
test -f tmp1/orary-path1/file1 &&
|
'
|
||||||
test -h tmp'
|
|
||||||
|
|
||||||
# Linus fix #3
|
test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '
|
||||||
test_expect_success SYMLINKS \
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
'use --prefix=tmp- where tmp-path1 is a symlink' \
|
mkdir tmp1 &&
|
||||||
'rm -fr path0 path1 path2 tmp* &&
|
ln -s tmp1 tmp-path1 &&
|
||||||
mkdir tmp1 &&
|
git checkout-index --prefix=tmp- -f -a &&
|
||||||
ln -s tmp1 tmp-path1 &&
|
test -f tmp-path0 &&
|
||||||
git checkout-index --prefix=tmp- -f -a &&
|
test ! -h tmp-path1 &&
|
||||||
test -f tmp-path0 &&
|
test -d tmp-path1 &&
|
||||||
test ! -h tmp-path1 &&
|
test -f tmp-path1/file1
|
||||||
test -d tmp-path1 &&
|
'
|
||||||
test -f tmp-path1/file1'
|
|
||||||
|
test_expect_success 'apply filter from working tree .gitattributes with --prefix' '
|
||||||
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
|
mkdir path1 &&
|
||||||
|
mkdir tmp &&
|
||||||
|
git config filter.replace-all.smudge "sed -e s/./,/g" &&
|
||||||
|
git config filter.replace-all.clean cat &&
|
||||||
|
git config filter.replace-all.required true &&
|
||||||
|
echo "file1 filter=replace-all" >path1/.gitattributes &&
|
||||||
|
git checkout-index --prefix=tmp/ -f -a &&
|
||||||
|
echo frotz >expected &&
|
||||||
|
test_cmp expected tmp/path0 &&
|
||||||
|
echo ,,,,,, >expected &&
|
||||||
|
test_cmp expected tmp/path1/file1
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'apply CRLF filter from working tree .gitattributes with --prefix' '
|
||||||
|
rm -fr path0 path1 path2 tmp* &&
|
||||||
|
mkdir path1 &&
|
||||||
|
mkdir tmp &&
|
||||||
|
echo "file1 eol=crlf" >path1/.gitattributes &&
|
||||||
|
git checkout-index --prefix=tmp/ -f -a &&
|
||||||
|
echo rezrovQ >expected &&
|
||||||
|
tr \\015 Q <tmp/path1/file1 >actual &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user