summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-29 18:01:27 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-29 18:01:27 (GMT)
commita07157ac624b2524a059a3414e99f6f44bebc1e7 (patch)
treeb97667543ac667bc7e0a8f22ed7d45ae0eb7459e /t
parent96651ef50837e1c121def715dcf7416e9bcb1d0b (diff)
parentaa4ed402c9721170fde2e9e43c3825562070e65e (diff)
downloadgit-a07157ac624b2524a059a3414e99f6f44bebc1e7.zip
git-a07157ac624b2524a059a3414e99f6f44bebc1e7.tar.gz
git-a07157ac624b2524a059a3414e99f6f44bebc1e7.tar.bz2
Merge branch 'jc/attr'
* jc/attr: Add 'filter' attribute and external filter driver definition. Add 'ident' conversion.
Diffstat (limited to 't')
-rwxr-xr-xt/t0021-conversion.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
new file mode 100755
index 0000000..bab9ecc
--- /dev/null
+++ b/t/t0021-conversion.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+test_description='blob conversion via gitattributes'
+
+. ./test-lib.sh
+
+cat <<\EOF >rot13.sh
+tr '[a-zA-Z]' '[n-za-mN-ZA-M]'
+EOF
+chmod +x rot13.sh
+
+test_expect_success setup '
+ git config filter.rot13.smudge ./rot13.sh &&
+ git config filter.rot13.clean ./rot13.sh &&
+
+ {
+ echo "*.t filter=rot13"
+ 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
+ echo '\''$ident$'\''
+ } >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
+'
+
+script='s/^\$ident: \([0-9a-f]*\) \$/\1/p'
+
+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