Makefile: transport.o depends on branch.h now
[git/gsoc2010-gitweb.git] / t / t0021-conversion.sh
blob6cb8d60ea2649495c0e3c8bbb8b7cc75c36799b7
1 #!/bin/sh
3 test_description='blob conversion via gitattributes'
5 . ./test-lib.sh
7 cat <<EOF >rot13.sh
8 #!$SHELL_PATH
9 tr \
10 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
11 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
12 EOF
13 chmod +x rot13.sh
15 test_expect_success setup '
16 git config filter.rot13.smudge ./rot13.sh &&
17 git config filter.rot13.clean ./rot13.sh &&
20 echo "*.t filter=rot13"
21 echo "*.i ident"
22 } >.gitattributes &&
25 echo a b c d e f g h i j k l m
26 echo n o p q r s t u v w x y z
27 echo '\''$Id$'\''
28 } >test &&
29 cat test >test.t &&
30 cat test >test.o &&
31 cat test >test.i &&
32 git add test test.t test.i &&
33 rm -f test test.t test.i &&
34 git checkout -- test test.t test.i
37 script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
39 test_expect_success check '
41 cmp test.o test &&
42 cmp test.o test.t &&
44 # ident should be stripped in the repository
45 git diff --raw --exit-code :test :test.i &&
46 id=$(git rev-parse --verify :test) &&
47 embedded=$(sed -ne "$script" test.i) &&
48 test "z$id" = "z$embedded" &&
50 git cat-file blob :test.t > test.r &&
52 ./rot13.sh < test.o > test.t &&
53 cmp test.r test.t
56 # If an expanded ident ever gets into the repository, we want to make sure that
57 # it is collapsed before being expanded again on checkout
58 test_expect_success expanded_in_repo '
60 echo "File with expanded keywords"
61 echo "\$Id\$"
62 echo "\$Id:\$"
63 echo "\$Id: 0000000000000000000000000000000000000000 \$"
64 echo "\$Id: NoSpaceAtEnd\$"
65 echo "\$Id:NoSpaceAtFront \$"
66 echo "\$Id:NoSpaceAtEitherEnd\$"
67 echo "\$Id: NoTerminatingSymbol"
68 } > expanded-keywords &&
71 echo "File with expanded keywords"
72 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
73 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
74 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
75 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
76 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
77 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
78 echo "\$Id: NoTerminatingSymbol"
79 } > expected-output &&
81 git add expanded-keywords &&
82 git commit -m "File with keywords expanded" &&
84 echo "expanded-keywords ident" >> .gitattributes &&
86 rm -f expanded-keywords &&
87 git checkout -- expanded-keywords &&
88 cat expanded-keywords &&
89 cmp expanded-keywords expected-output
92 test_done