+badattr working-tree-encoding ISO-8859-1 UTF-16
+
+man gitattributes \
+| perl -ne 'print $1,"\n" if m/^ *(\w[-a-z]*)$/' \
+> grepped-attrs
+
+exec <grepped-attrs
+while read attr; do
+ badattr $attr
+done
+
+sha256sum .dotfile-attr af/* >sums
+
+# ----- common to source formats -----
+
+sfmt_setup () {
+ v=$1
+ sfmt=$2
+
+ pdb=$p.$sfmt
+
+ local addpatch=${sfmt}_addpatch
+ local convert=${sfmt}_convert
+
+ cp -a $p $pdb-edit
+ cd $pdb-edit
+
+ $convert
+
+ dch -v $v -m convert
+
+ rm -rf .git
+
+ cp ../gitattrs .gitattributes
+ $addpatch gitattrs
+
+ cp -a ../af ../.dotfile-attr .
+ $addpatch files
+
+ cp ../sums .
+ $addpatch sums
+
+ dpkg-source -b .
+
+ cd ..
+}
+
+sums_check () {
+ # caller should cd into working directory, set
+ # $sums $branch
+ # and check out $branch
+
+ sha256sum .dotfile-attr af/* >../$sums.checkout
+ diff -U0 ../sums ../$sums.checkout
+
+ for f in .dotfile-attr af/*; do
+ git cat-file blob "refs/heads/$branch:$f" \
+ | sha256sum \
+ | sed -e 's#-$#'$f'#' \
+ >>../$sums
+ done
+
+ diff -U0 ../sums ../$sums
+}
+
+sums_check_broken () {
+ # caller should cd into working directory, set
+ # $sums
+ # and check out the broken branch
+
+ sha256sum .dotfile-attr af/* >../$sums.broken
+
+ for s in ../sums ../$sums.broken; do
+ sed 's/[0-9a-f]* //' $s >$s.nosums
+ done
+ diff -U0 ../sums.nosums ../$sums.broken.nosums
+ set +e
+ diff -U0 ../sums ../$sums.broken
+ rc=$?
+ set -e
+ test $rc = 1
+}
+
+t-dgit-warn-check () {
+ local warnok=$1; shift
+ # warnok should be 0 if the warning is expected
+ # 1 if the warning is NOT expected