+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
+
+ local err=stderr.$wd
+
+ LC_MESSAGES=C t-dgit "$@" 2>&1 |tee ../$err
+
+ set +e
+ egrep 'warning: .* contains \.gitattributes' ../$err
+ rc=$?
+ set -e
+
+ test "$rc" = "$warnok"
+}
+