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 # xxx want to make each of these files into a quilt patch
49 t-git-config core.eol crlf
55 t-git-config filter.dgit-test-crazy-f.smudge '/usr/games/rot13 2'
56 t-git-config filter.dgit-test-crazy-f.clean '/usr/games/rot13 24'
57 t-git-config filter.dgit-test-crazy-f.requrired true
59 badattr filter dgit-test-crazy-f
62 badattr merge text binary union
67 badattr encoding no-such-encoding
68 badattr working-tree-encoding ISO-8859-1 UTF-16
71 | perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \
81 # ----- common to source formats -----
89 local addpatch=${sfmt}_addpatch
90 local convert=${sfmt}_convert
101 cp ../gitattrs .gitattributes
116 # caller should cd into working directory, set
118 # and check out $branch
120 sha256sum af/* >../$sums.checkout
121 diff -U0 ../sums ../$sums.checkout
124 git cat-file blob "refs/heads/$branch:$f" \
126 | sed -e 's#-$#'$f'#' \
130 diff -U0 ../sums ../$sums
133 sums_check_broken () {
134 # caller should cd into working directory, set
136 # and check out the broken branch
138 sha256sum af/* >../$sums.broken
140 for s in ../sums ../$sums.broken; do
141 sed 's/[0-9a-f]* //' $s >$s.nosums
143 diff -U0 ../sums.nosums ../$sums.broken.nosums
145 diff -U0 ../sums ../$sums.broken
151 t-dgit-warn-check () {
152 local warnok=$1; shift
153 # warnok should be 0 if the warning is expected
154 # 1 if the warning is NOT expected
158 LC_MESSAGES=C t-dgit "$@" 2>&1 |tee ../$err
161 egrep 'warning: .* contains \.gitattributes' ../$err
165 test "$rc" = "$warnok"
171 branch="import.$sfmt-$inst"
173 sums=sums.$sfmt-$inst
180 t-dgit-warn-check 0 $dgitargs import-dsc ../$dscf +$branch.broken
182 git checkout $branch.broken
186 t-dgit setup-new-tree
188 t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch
198 : ----- generate the orig -----
200 origtar=${p}_${bv}.orig.tar.gz
202 tar --exclude=debian --exclude=.git -zcf $origtar $p
204 : ----- test 1.0 native -----
206 native_addpatch () { :; }
207 native_convert () { :; }
209 sfmt_setup 1.1 native
212 : ----- test 1.0 diff -----
214 diff_addpatch () { :; }
215 diff_convert () { :; }
220 : ----- test "3.0 (quilt)" -----
224 cat >../editor.pl <<END
226 s{^(description:).*}{\$1 dgit test patch $pname}i;
229 EDITOR="perl -pi $tmp/editor.pl" dpkg-source -iX --commit . $pname
230 test -f debian/patches/$pname
234 mkdir -p debian/source
235 echo '3.0 (quilt)' >debian/source/format
238 sfmt_setup 1.0-1 quilt
240 sfmt_import absurd --force-import-gitapply-absurd
242 : ----- 'test clone (with "3.0 (quilt)")' -----
244 mv $origtar ${dscf%.dsc}.* $tmp/mirror/pool/main/
247 t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
248 clone $p sid $p.clone.broken
256 t-dgit-warn-check 1 clone $p sid $p.clone
265 t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
266 clone $p sid $p.clone.old
271 cat >.git/info/attributes <<'END'
273 [attr]dgit-defuse-attrs -text -eol -crlf -ident -filter
274 # ^ see GITATTRIBUTES in dgit(7) and dgit setup-new-tree in dgit(1)
277 t-dgit setup-gitattributes