2007-04-22 04:09:02 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='blob conversion via gitattributes'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2007-04-21 12:14:13 +02:00
|
|
|
cat <<\EOF >rot13.sh
|
|
|
|
tr '[a-zA-Z]' '[n-za-mN-ZA-M]'
|
|
|
|
EOF
|
|
|
|
chmod +x rot13.sh
|
|
|
|
|
2007-04-22 04:09:02 +02:00
|
|
|
test_expect_success setup '
|
2007-04-21 12:14:13 +02:00
|
|
|
git config filter.rot13.smudge ./rot13.sh &&
|
|
|
|
git config filter.rot13.clean ./rot13.sh &&
|
|
|
|
|
2007-04-22 04:09:02 +02:00
|
|
|
{
|
2007-04-21 12:14:13 +02:00
|
|
|
echo "*.t filter=rot13"
|
2007-04-22 04:09:02 +02:00
|
|
|
echo "*.i ident"
|
|
|
|
} >.gitattributes &&
|
|
|
|
|
|
|
|
{
|
|
|
|
echo a b c d e f g h i j k l m
|
|
|
|
echo n o p q r s t u v w x y z
|
2007-05-14 15:37:25 +02:00
|
|
|
echo '\''$Id$'\''
|
2007-04-22 04:09:02 +02:00
|
|
|
} >test &&
|
|
|
|
cat test >test.t &&
|
|
|
|
cat test >test.o &&
|
|
|
|
cat test >test.i &&
|
|
|
|
git add test test.t test.i &&
|
|
|
|
rm -f test test.t test.i &&
|
|
|
|
git checkout -- test test.t test.i
|
|
|
|
'
|
|
|
|
|
2007-05-14 15:37:25 +02:00
|
|
|
script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
|
2007-04-22 04:09:02 +02:00
|
|
|
|
|
|
|
test_expect_success check '
|
|
|
|
|
|
|
|
cmp test.o test &&
|
|
|
|
cmp test.o test.t &&
|
|
|
|
|
|
|
|
# ident should be stripped in the repository
|
|
|
|
git diff --raw --exit-code :test :test.i &&
|
|
|
|
id=$(git rev-parse --verify :test) &&
|
|
|
|
embedded=$(sed -ne "$script" test.i) &&
|
|
|
|
test "z$id" = "z$embedded"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|