3 test_description
='blob conversion via gitattributes'
9 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
10 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
14 test_expect_success setup
'
15 git config filter.rot13.smudge ./rot13.sh &&
16 git config filter.rot13.clean ./rot13.sh &&
19 echo "*.t filter=rot13"
24 echo a b c d e f g h i j k l m
25 echo n o p q r s t u v w x y z
31 git add test test.t test.i &&
32 rm -f test test.t test.i &&
33 git checkout -- test test.t test.i
36 script='s/^\$Id: \([0-9a-f]*\) \$/\1/p'
38 test_expect_success check
'
43 # ident should be stripped in the repository
44 git diff --raw --exit-code :test :test.i &&
45 id=$(git rev-parse --verify :test) &&
46 embedded=$(sed -ne "$script" test.i) &&
47 test "z$id" = "z$embedded" &&
49 git cat-file blob :test.t > test.r &&
51 ./rot13.sh < test.o > test.t &&
55 # If an expanded ident ever gets into the repository, we want to make sure that
56 # it is collapsed before being expanded again on checkout
57 test_expect_success expanded_in_repo
'
59 echo "File with expanded keywords"
62 echo "\$Id: 0000000000000000000000000000000000000000 \$"
63 echo "\$Id: NoSpaceAtEnd\$"
64 echo "\$Id:NoSpaceAtFront \$"
65 echo "\$Id:NoSpaceAtEitherEnd\$"
66 echo "\$Id: NoTerminatingSymbol"
67 } > expanded-keywords &&
70 echo "File with expanded keywords"
71 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
72 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
73 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
74 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
75 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
76 echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
77 echo "\$Id: NoTerminatingSymbol"
78 } > expected-output &&
80 git add expanded-keywords &&
81 git commit -m "File with keywords expanded" &&
83 echo "expanded-keywords ident" >> .gitattributes &&
85 rm -f expanded-keywords &&
86 git checkout -- expanded-keywords &&
87 cat expanded-keywords &&
88 cmp expanded-keywords expected-output