diff options
-rwxr-xr-x | tests/tests/gitattributes | 137 |
1 files changed, 90 insertions, 47 deletions
diff --git a/tests/tests/gitattributes b/tests/tests/gitattributes index 0b4bad6..7452082 100755 --- a/tests/tests/gitattributes +++ b/tests/tests/gitattributes @@ -6,36 +6,13 @@ t-dependencies bsdgames t-tstunt-parsechangelog t-archive-none example -v=1.0 -t-worktree $v +bv=1.0 +t-worktree $bv -cd $p - -: ----- convert to "3.0 (quilt)" - -rm -rf .git -tar --exclude=debian -C .. -zcf ../${p}_${v}.orig.tar.gz $p -dch -v 1.0-1 -m convert -mkdir -p debian/source -echo '3.0 (quilt)' >debian/source/format - -v=1.0-1 - -: ----- make everything break ----- +: ----- prepare badnesses ----- mkdir af -addpatch () { - pname=$1 - cat >../editor.pl <<END - next if m/^$/..0; - s{^(description:).*}{\$1 dgit test patch $pname}i; - \$_='' if m/^ /; -END - EDITOR="perl -pi $tmp/editor.pl" dpkg-source -iX --commit . $pname - test -f debian/patches/$pname -} - badattr1 () { local filename=$1 local attrspec=$2 @@ -43,7 +20,7 @@ badattr1 () { printf >>af/$filename 'crlf: \r\n' echo >>af/$filename 'id $Id: $' echo >>af/$filename 'id $Id: SPLARK $' - echo >>.gitattributes "af/$filename" "$attrspec" + echo >>gitattrs "af/$filename" "$attrspec" } badattr () { @@ -79,33 +56,99 @@ badattr export-subst badattr delta badattr encoding no-such-encoding -mv af ../af.aside -addpatch gitattrs +sha256sum af/* >sums -mv ../af.aside af -addpatch files +# ----- common to source formats ----- -sha256sum af/* >sums -addpatch sums +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 -dpkg-source -b . + $convert -cd .. -mkdir $p.import -cd $p.import -git init + dch -v $v -m convert -#t-dgit --force-import-gitapply-absurd import-dsc ../${p}_${v}.dsc +import -t-dgit import-dsc ../${p}_${v}.dsc +import + rm -rf .git + + cp ../gitattrs .gitattributes + $addpatch gitattrs + + cp -a ../af . + $addpatch files + + cp ../sums . + $addpatch sums + + dpkg-source -b . + + cd .. +} -git checkout import +sfmt_import () { + inst=$1 + dgitargs=$2 + refname="import.$sfmt-$inst" -for f in af/*; do - git cat-file blob "refs/heads/import:$f" | sha256sum | \ - sed -e 's#-$#'$f'#' \ - >>../sums -done + mkdir $pdb-import-$inst + cd $pdb-import-$inst + git init + t-dgit setup-new-tree + + t-dgit $dgitargs import-dsc ../${p}_${v}.dsc +$refname + git checkout $refname + + sums=sums.$sfmt-$inst + + for f in af/*; do + git cat-file blob "refs/heads/$refname:$f" | sha256sum | \ + sed -e 's#-$#'$f'#' \ + >>../$sums + done + + cd .. + diff -U0 sums $sums +} + +: ----- generate the orig ----- + +tar --exclude=debian -zcf ${p}_${bv}.orig.tar.gz $p + +: ----- test 1.0 native ----- + +native_addpatch () { :; } +native_convert () { :; } + +sfmt_setup 1.1 native +sfmt_import norm + +: ----- test "3.0 (quilt)" + +quilt_addpatch () { + pname=$1 + cat >../editor.pl <<END + next if m/^$/..0; + s{^(description:).*}{\$1 dgit test patch $pname}i; + \$_='' if m/^ /; +END + EDITOR="perl -pi $tmp/editor.pl" dpkg-source -iX --commit . $pname + test -f debian/patches/$pname +} + +quilt_convert () { + mkdir -p debian/source + echo '3.0 (quilt)' >debian/source/format +} -diff -U0 sums ../sums +sfmt_setup 1.0-1 quilt +sfmt_import norm +sfmt_import absurd --force-import-gitapply-absurd #t-ok |