cd ..
}
-sfmt_import () {
- inst=$1
- dgitargs=$2
- refname="import.$sfmt-$inst"
- brkerr=stderr.$sfmt-$inst.broken
- dscf=${p}_${v}.dsc
+sums_check () {
+ # caller should cd into working directory, set
+ # $sums $branch
+ # and check out $branch
- mkdir $pdb-import-$inst
- cd $pdb-import-$inst
- git init
+ 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
- LC_MESSAGES=C \
- t-dgit $dgitargs import-dsc ../$dscf +$refname.broken \
- 2>&1 |tee ../$brkerr
- fgrep 'warning: source tree contains .gitattributes' ../$brkerr
- git checkout $refname.broken
sha256sum af/* >../$sums.broken
for s in ../sums ../$sums.broken; do
rc=$?
set -e
test $rc = 1
+}
- t-dgit setup-new-tree
+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
+ fgrep 'warning: source tree contains .gitattributes' ../$err
+ rc=$?
+ set -e
- t-dgit $dgitargs import-dsc ../$dscf +$refname
- git checkout $refname
+ test "$rc" = "$warnok"
+}
+sfmt_import () {
+ inst=$1
+ dgitargs=$2
+ branch="import.$sfmt-$inst"
+ dscf=${p}_${v}.dsc
sums=sums.$sfmt-$inst
+ wd=$pdb-import-$inst
- for f in af/*; do
- git cat-file blob "refs/heads/$refname:$f" \
- | sha256sum \
- | sed -e 's#-$#'$f'#' \
- >>../$sums
- done
+ mkdir $wd
+ cd $wd
+ git init
+
+ t-dgit-warn-check 0 $dgitargs import-dsc ../$dscf +$branch.broken
+
+ git checkout $branch.broken
+
+ sums_check_broken
+
+ t-dgit setup-new-tree
+
+ t-dgit-warn-check 1 $dgitargs import-dsc ../$dscf +$branch
+ git checkout $branch
+ git reset --hard
+
+ sums_check
cd ..
- diff -U0 sums $sums
}
: ----- generate the orig -----