v=1.0-1
+t-tagupl-settings
+
cd $p
+git checkout -b native
+
git checkout --orphan upstream quilt-tip-2
git rm -rf debian
git commit -m 'pseudo-upstream'
git checkout -B master quilt-tip-2
-#git-deborig
-#t-dgit --quilt=gbp --dgit-view-save=split.b1 push-source --new --overwrite
-#xxx
-
upstream=$(git rev-parse upstream/1.0~0)
tagname=test-dummy/$v
-${DGIT_DEBPUSH_TEST-git debpush} \
- --distro=test-dummy --quilt=gbp --no-push -u Senatus
+t-tagupl-test --no-push --quilt=gbp
# xxx test pushing
-cd ..
-mkdir tagupl
-cd tagupl
+# todo: test each miss/rejection
-export DGIT_DRS_EMAIL_NOREPLY=noreply@example.org
-export DGIT_DRS_SENDMAIL=$troot/tstunt/sendmail
-export DGIT_DRS_DGIT=$troot/tstunt/dgit
-t-chain-test-somehow
+ident=ok
-DGIT_DRS_ANY_URL=1 \
-DGIT_DRS_MODE="tag2upload $tmp/$p $tagname" \
- $troot/drs-git-ext
+git cat-file tag $tagname >../basetag
+v=1.0-2
+tagname=test-dummy/$v
-# todo: test each miss/rejection
+perl -i -ne '
+ next if $.==1../^$/;
+ next if m/^----/..0;
+ s/\b1\.0-1\b/1.0-2/g;
+ print or die $!;
+' ../basetag
+
+mv-ident () {
+ local f=$tmp/$1
+ if test -e $f; then
+ mv $f $f--$ident
+ fi
+}
+
+next-mangle () {
+ mv-ident tagupl/overall.log
+ mv-ident sendmail.log
+ ident=$1
+}
+
+with-mangled () {
+ local perl=$1
+ perl <../basetag >../badtag-$ident -pe "$perl"
+ git tag -u Senatus -f -s -m "$(cat ../badtag-$ident)" "$tagname"
+
+ t-tagupl-run-drs
+}
+
+expect-quit () {
+ next-mangle "$1"
+ local perl=$2
+ local mstring=$3
+ with-mangled "$perl"
+ grep ": $mstring" ../tagupl/overall.log
+}
+
+tagname=test-dummy/1.2
+t-expect-fail E:'failed command: git fetch' \
+t-tagupl-run-drs
+
+tagname=splorf/$v ; expect-quit baddistro '' 'tag name not for us'
+tagname=test-dummy/1,2; expect-quit badver '' 'tag name not for us'
+tagname=test-dummy/$v
+
+expect-quit noplease s/please-upload/plunk/ 'tag missing please-upload'
-cd $tmp/$p
+# we are going to trash $p because it will contain corrupted objects
+# which makes our end-of-test fsck fail
+cp -al ../$p ../$p.save
+cd ../$p
-t-dgit fetch
-t-pushed-good master
+next-mangle badtagger
+git cat-file tag test-dummy/1.0-1 | perl -pe '
+ s/\+\d+$/xyz/ if m/^tagger /;
+ exit 0 if m/^$/;
+' >../tagobj-$ident
+echo >>../tagobj-$ident
+cat ../basetag >>../tagobj-$ident
+git update-ref $tagname $(git hash-object -w -t tag ../tagobj-$ident)
+
+cd ..
+rm -rf $p
+mv $p.save $p
t-ok