. tests/lib
t-dependencies bsdgames
+t-dependencies man-db git-man
t-tstunt-parsechangelog
t-archive-none example
+t-git-none
bv=1.0
t-worktree $bv
badattr delta
badattr encoding no-such-encoding
+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 af/* >sums
# ----- common to source formats -----
cd ..
}
+sums_check () {
+ # caller should cd into working directory, set
+ # $sums $branch
+ # and check out $branch
+
+ sha256sum af/* >../$sums.checkout
+ diff -U0 ../sums ../$sums.checkout
+
+ for f in 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 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"
+}
+
sfmt_import () {
inst=$1
dgitargs=$2
- refname="import.$sfmt-$inst"
+ branch="import.$sfmt-$inst"
+ dscf=${p}_${v}.dsc
+ sums=sums.$sfmt-$inst
+ wd=$pdb-import-$inst
- mkdir $pdb-import-$inst
- cd $pdb-import-$inst
+ mkdir $wd
+ cd $wd
git init
- t-dgit setup-new-tree
- t-dgit $dgitargs import-dsc ../${p}_${v}.dsc +$refname
- git checkout $refname
+ t-dgit-warn-check 0 $dgitargs import-dsc ../$dscf +$branch.broken
- sums=sums.$sfmt-$inst
+ git checkout $branch.broken
- for f in af/*; do
- git cat-file blob "refs/heads/$refname:$f" | sha256sum | \
- sed -e 's#-$#'$f'#' \
- >>../$sums
- done
+ sums_check_broken
+
+ t-dgit setup-new-tree
+
+ t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch
+ git checkout $branch
+ touch af/*
+ git reset --hard
+
+ sums_check
cd ..
- diff -U0 sums $sums
}
: ----- generate the orig -----
-tar --exclude=debian -zcf ${p}_${bv}.orig.tar.gz $p
+origtar=${p}_${bv}.orig.tar.gz
+
+tar --exclude=debian --exclude=.git -zcf $origtar $p
: ----- test 1.0 native -----
sfmt_setup 1.1 native
sfmt_import norm
-: ----- test "3.0 (quilt)"
+: ----- test 1.0 diff -----
+
+diff_addpatch () { :; }
+diff_convert () { :; }
+
+sfmt_setup 1.1 diff
+sfmt_import norm
+
+: ----- test "3.0 (quilt)" -----
quilt_addpatch () {
pname=$1
sfmt_import norm
sfmt_import absurd --force-import-gitapply-absurd
-#t-ok
+: ----- 'test clone (with "3.0 (quilt)")' -----
+
+mv $origtar ${dscf%.dsc}.* $tmp/mirror/pool/main/
+t-archive-query sid
+
+t-dgit-warn-check 0 -cdgit.default.setup-gitattributes=false \
+ clone $p sid $p.clone.broken
+cd $p.clone.broken
+
+sums=$p.clone.broken
+sums_check_broken
+
+cd ..
+
+t-dgit-warn-check 1 clone $p sid $p.clone
+
+cd $p.clone
+sums=sums.clone
+branch=dgit/sid
+sums_check
+
+cd ..
+
+t-ok