5 t-dependencies bsdgames
6 t-dependencies man-db git-man
7 t-tstunt-parsechangelog
14 : ----- prepare badnesses -----
21 echo >>af/$filename "Test file with $attrspec"
22 printf >>af/$filename 'crlf: \r\n'
23 echo >>af/$filename 'id $Id: $'
24 echo >>af/$filename 'id $Id: SPLARK $'
25 printf >>af/$filename '\xEF\xBB\xBF <- UTF-8 BOM\n'
26 echo >>gitattrs "af/$filename" "$attrspec"
33 working-tree-encoding) ;;
35 badattr1 $attrname-set $attrname
39 badattr1 $attrname-unset -$attrname
40 badattr1 $attrname-unspec \!$attrname
43 badattr1 $attrname=$val $attrname=$val
47 # todo: want to make each of these files into a quilt patch
49 t-git-config core.eol crlf
51 printf >>.dotfile-attr 'dotfiles too?\n'
52 echo >>gitattrs '.dotfile-attr filter=dgit-test-crazy-f'
58 t-git-config filter.dgit-test-crazy-f.smudge '/usr/games/rot13 2'
59 t-git-config filter.dgit-test-crazy-f.clean '/usr/games/rot13 24'
60 t-git-config filter.dgit-test-crazy-f.requrired true
62 badattr filter dgit-test-crazy-f
65 badattr merge text binary union
70 badattr encoding no-such-encoding
71 badattr working-tree-encoding ISO-8859-1 UTF-16
74 | perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \
82 sha256sum .dotfile-attr af/* >sums
84 # ----- common to source formats -----
92 local addpatch=${sfmt}_addpatch
93 local convert=${sfmt}_convert
104 cp ../gitattrs .gitattributes
107 cp -a ../af ../.dotfile-attr .
119 # caller should cd into working directory, set
121 # and check out $branch
123 sha256sum .dotfile-attr af/* >../$sums.checkout
124 diff -U0 ../sums ../$sums.checkout
126 for f in .dotfile-attr af/*; do
127 git cat-file blob "refs/heads/$branch:$f" \
129 | sed -e 's#-$#'$f'#' \
133 diff -U0 ../sums ../$sums
136 sums_check_broken () {
137 # caller should cd into working directory, set
139 # and check out the broken branch
141 sha256sum .dotfile-attr af/* >../$sums.broken
143 for s in ../sums ../$sums.broken; do
144 sed 's/[0-9a-f]* //' $s >$s.nosums
146 diff -U0 ../sums.nosums ../$sums.broken.nosums
148 diff -U0 ../sums ../$sums.broken
154 t-dgit-warn-check () {
155 local warnok=$1; shift
156 # warnok should be 0 if the warning is expected
157 # 1 if the warning is NOT expected
161 LC_MESSAGES=C t-dgit "$@" 2>&1 |tee ../$err
164 egrep 'warning: .* contains \.gitattributes' ../$err
168 test "$rc" = "$warnok"
174 branch="import.$sfmt-$inst"
176 sums=sums.$sfmt-$inst
183 t-dgit-warn-check 0 $dgitargs import-dsc ../$dscf +$branch.broken
185 git checkout $branch.broken
189 t-dgit setup-new-tree
191 t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch
193 touch .dotfile-attr af/*
201 : ----- generate the orig -----
203 origtar=${p}_${bv}.orig.tar.gz
205 tar --exclude=debian --exclude=.git -zcf $origtar $p
207 : ----- test 1.0 native -----
209 native_addpatch () { :; }
210 native_convert () { :; }
212 sfmt_setup 1.1 native
215 : ----- test 1.0 diff -----
217 diff_addpatch () { :; }
218 diff_convert () { :; }
223 : ----- test "3.0 (quilt)" -----
227 cat >../editor.pl <<END
229 s{^(description:).*}{\$1 dgit test patch $pname}i;
232 EDITOR="perl -pi $tmp/editor.pl" dpkg-source -iX --commit . $pname
233 test -f debian/patches/$pname
237 mkdir -p debian/source
238 echo '3.0 (quilt)' >debian/source/format
241 sfmt_setup 1.0-1 quilt
243 sfmt_import absurd --force-import-gitapply-absurd
245 : ----- 'test clone (with "3.0 (quilt)")' -----
247 mv $origtar ${dscf%.dsc}.* $tmp/mirror/pool/main/
250 t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
251 clone $p sid $p.clone.broken
259 t-dgit-warn-check 1 clone $p sid $p.clone
268 t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
269 clone $p sid $p.clone.old
274 cat >.git/info/attributes <<'END'
276 [attr]dgit-defuse-attrs -text -eol -crlf -ident -filter
277 # ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1)
280 t-dgit setup-gitattributes