summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2023-09-02 10:50:30 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2023-09-03 00:48:48 +0100
commit39785224ea1e402960ab9ca82112260aec4b57b7 (patch)
treef628e26884552916c33c79e42bcb33ccb4d64338
parent5c029d8c0134df9d1eeef083e6eb8f74866fd7b3 (diff)
dgit: Prevent pushing old versions (test)
Resolved conflict in debian/tests/control by regenerating it. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r--debian/tests/control2
-rwxr-xr-xtests/tests/import-pushold37
2 files changed, 38 insertions, 1 deletions
diff --git a/debian/tests/control b/debian/tests/control
index a22400b..99ef534 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -100,7 +100,7 @@ Tests: trustingpolicy-replay
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, faketime, liburi-perl, dput-ng
-Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-long build-modes-source checkout clone-clogsigpipe debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp debpolicy-taintrm defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-push-masterupdate drs-push-rejects dsd-divert fetch-localgitonly fetch-somegit-notlast forcesplit-linear forcesplit-overwrite gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version pbuilder protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-include-binaries quilt-singlepatch quilt-splitbrains quilt-useremail rpush rpush-quilt rpush-source sourceonlypolicy tag-updates unrepresentable unrepresentable-single-dpkg unrepresentable-single-git version-opt
+Tests: absurd-gitapply badcommit-rewrite build-modes build-modes-long build-modes-source checkout clone-clogsigpipe debpolicy-dbretry debpolicy-newreject debpolicy-quilt-gbp debpolicy-taintrm defdistro-rpush defdistro-setup distropatches-reject dpkgsourceignores-correct drs-push-masterupdate drs-push-rejects dsd-divert fetch-localgitonly fetch-somegit-notlast forcesplit-linear forcesplit-overwrite gbp-orig gitconfig gitworktree import-dsc import-maintmangle import-native import-nonnative import-pushold import-tarbomb inarchivecopy mismatches-contents mismatches-dscchanges multisuite orig-include-exclude orig-include-exclude-chkquery overwrite-chkclog overwrite-junk overwrite-splitbrains overwrite-version pbuilder protocol-compat push-buildproductsdir push-newpackage push-newrepeat push-nextdgit push-source push-source-with-changes quilt quilt-gbp quilt-gbp-build-modes quilt-include-binaries quilt-singlepatch quilt-splitbrains quilt-useremail rpush rpush-quilt rpush-source sourceonlypolicy tag-updates unrepresentable unrepresentable-single-dpkg unrepresentable-single-git version-opt
Tests-Directory: tests/tests
Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, build-essential, chiark-utils-bin, bc, faketime, liburi-perl
diff --git a/tests/tests/import-pushold b/tests/tests/import-pushold
new file mode 100755
index 0000000..ed73fa3
--- /dev/null
+++ b/tests/tests/import-pushold
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+t-tstunt-parsechangelog
+
+p=example
+old=1.0-1
+current=1.0-1.100
+
+t-archive $p $current
+t-git-none
+
+mkdir $p
+cd $p
+git init
+t-dgit import-dsc $troot/pkg-srcs/${p}_${old}.dsc main
+git checkout main
+
+t-dgit fetch
+
+: "attempt push of old"
+
+t-expect-fail 'trying to push an old version' \
+t-dgit push-source --deliberately-not-fast-forward --overwrite
+
+: "attempt push of current"
+
+t-dgit checkout sid
+
+t-expect-fail 'trying to push an old version' \
+t-dgit push-source --deliberately-not-fast-forward --overwrite
+
+t-dgit push-source --force-uploading-old-version
+t-pushed-good dgit/sid
+
+t-ok