double free in builtin-update-index.c
[git/dscho.git] / t / t0021-conversion.sh
bloba839f4e0744cd9344a3d71a48fe2224a99750729
1 #!/bin/sh
3 test_description='blob conversion via gitattributes'
5 . ./test-lib.sh
7 cat <<\EOF >rot13.sh
8 tr '[a-zA-Z]' '[n-za-mN-ZA-M]'
9 EOF
10 chmod +x rot13.sh
12 test_expect_success setup '
13 git config filter.rot13.smudge ./rot13.sh &&
14 git config filter.rot13.clean ./rot13.sh &&
17 echo "*.t filter=rot13"
18 echo "*.i ident"
19 } >.gitattributes &&
22 echo a b c d e f g h i j k l m
23 echo n o p q r s t u v w x y z
24 echo '\''$Id$'\''
25 } >test &&
26 cat test >test.t &&
27 cat test >test.o &&
28 cat test >test.i &&
29 git add test test.t test.i &&
30 rm -f test test.t test.i &&
31 git checkout -- test test.t test.i
34 script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
36 test_expect_success check '
38 cmp test.o test &&
39 cmp test.o test.t &&
41 # ident should be stripped in the repository
42 git diff --raw --exit-code :test :test.i &&
43 id=$(git rev-parse --verify :test) &&
44 embedded=$(sed -ne "$script" test.i) &&
45 test "z$id" = "z$embedded"
48 # If an expanded ident ever gets into the repository, we want to make sure that
49 # it is collapsed before being expanded again on checkout
50 test_expect_success expanded_in_repo '
52 echo "File with expanded keywords"
53 echo "\$Id\$"
54 echo "\$Id:\$"
55 echo "\$Id: 0000000000000000000000000000000000000000 \$"
56 echo "\$Id: NoSpaceAtEnd\$"
57 echo "\$Id:NoSpaceAtFront \$"
58 echo "\$Id:NoSpaceAtEitherEnd\$"
59 echo "\$Id: NoTerminatingSymbol"
60 } > expanded-keywords &&
63 echo "File with expanded keywords"
64 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
65 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
66 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
67 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
68 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
69 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
70 echo "\$Id: NoTerminatingSymbol"
71 } > expected-output &&
73 git add expanded-keywords &&
74 git commit -m "File with keywords expanded" &&
76 echo "expanded-keywords ident" >> .gitattributes &&
78 rm -f expanded-keywords &&
79 git checkout -- expanded-keywords &&
80 cat expanded-keywords &&
81 cmp expanded-keywords expected-output
84 test_done