chiark / gitweb /
dgit: Fail early when the archive/ tag already exists.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 5 Sep 2019 15:34:33 +0000 (16:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 5 Sep 2019 17:15:20 +0000 (18:15 +0100)
Suggest using a new version number.

We need a new --force option to override this check.

Closes: #935802
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit
dgit.1

diff --git a/dgit b/dgit
index 6f240ab0517de64ad24ff7abe29de44e8382ef5e..56b2ee957e7c95f3a2eba328969df95843565c4f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -102,6 +102,7 @@ our %forceopts = map { $_=>0 }
     qw(unrepresentable unsupported-source-format
        dsc-changes-mismatch changes-origs-exactly
        uploading-binaries uploading-source-only
+       reusing-version
        import-gitapply-absurd
        import-gitapply-no-absurd
        import-dsc-with-dgit-field);
@@ -4601,6 +4602,20 @@ END
 
     confess unless !!$made_split_brain == do_split_brain();
 
+    my $tagname = debiantag_new $cversion, access_nomdistro();
+    if (!(forceing[qw(reusing-version)]) && git_get_ref "refs/tags/$tagname") {
+       supplementary_message '';
+       print STDERR f_ <<END, $cversion;
+
+Version %s has already been tagged (pushed?)
+If this was a failed (or incomplete or rejected) upload by you, just
+add a new changelog stanza for a new version number and try again.
+END
+       fail f_ <<END, $tagname;
+Tag %s already exists.
+END
+    }
+
     changedir $playground;
     progress f_ "checking that %s corresponds to HEAD", $dscfn;
     runcmd qw(dpkg-source -x --),
diff --git a/dgit.1 b/dgit.1
index 8969e2f24c45b94c53553539e286af31873a894d..e619188434c988aaf9cc7bf4974fcfc78c66d560 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -1293,6 +1293,13 @@ The result is a fresh import,
 discarding the git history
 that the person who pushed that .dsc was working with.
 .TP
+.B \-\-force-reusing-version
+Carry on even though this involves reusing a version number
+of a previous push or upload.
+It is normally best to give different versions different numbers.
+Some servers (including, usually, the Debian server)
+will reject attempts to reuse or replace already-pushed versions.
+.TP
 .B \-\-force-uploading-binaries
 Carry on and
 upload binaries