3 test_description
='blob conversion via gitattributes'
10 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \
11 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM'
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"
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
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
'
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 &&
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"
63 echo "\$Id: 0000000000000000000000000000000000000000 \$"
64 echo "\$Id: NoSpaceAtEnd\$"
65 echo "\$Id:NoSpaceAtFront \$"
66 echo "\$Id:NoSpaceAtEitherEnd\$"
67 echo "\$Id: NoTerminatingSymbol"
68 echo "\$Id: Foreign Commit With Spaces \$"
69 echo "\$Id: NoTerminatingSymbolAtEOF"
70 } > expanded-keywords &&
73 echo "File with expanded keywords"
74 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
75 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
76 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
77 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
78 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
79 echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
80 echo "\$Id: NoTerminatingSymbol"
81 echo "\$Id: Foreign Commit With Spaces \$"
82 echo "\$Id: NoTerminatingSymbolAtEOF"
83 } > expected-output &&
85 git add expanded-keywords &&
86 git commit -m "File with keywords expanded" &&
88 echo "expanded-keywords ident" >> .gitattributes &&
90 rm -f expanded-keywords &&
91 git checkout -- expanded-keywords &&
92 cat expanded-keywords &&
93 cmp expanded-keywords expected-output