chiark / gitweb /
Tag change: Update dgit-repos-server
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Jul 2016 14:14:00 +0000 (15:14 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jul 2016 21:33:13 +0000 (22:33 +0100)
Change the calls to debiantag_old to changes to debiantags, and the
regexp to tolerate either tag name.

We need an additional check that we are not receiving the tag named by
debiantag_new when debiantag_old already exists.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
TODO.BRANCH
infra/dgit-repos-server

index b2908422d86feebd34ac16caff4942310b5969ea..defdeeef5407441d104bd5b2f4f34aa261ab8e46 100644 (file)
@@ -11,6 +11,11 @@ Tag rename unfinished business
 
  - other tag should be [dgit Maintainer-Tag quilt=$quilt-mode]
 
+
+Want tests for
+ - accepting old and new version tags
+ - rejecting push of same version with one tag when then the other
+
 ----------
 
 Provide --gpbpq[=:] options
index 3c8734194c13368e04750da23fd027a8165a22a7..f7d1b045b82c53af39c5144e366b43e65ce223f4 100755 (executable)
@@ -342,7 +342,8 @@ sub movetogarbage () {
 
     ensuredir "$dgitrepos/_removed-tags";
     open PREVIOUS, ">>", removedtagsfile or die removedtagsfile." $!";
-    git_for_each_ref('refs/tags/'.debiantag_old('*',$distro), sub {
+    git_for_each_ref([ map { 'refs/tags/'.$_ } debiantags('*',$distro) ],
+                    sub {
        my ($objid,$objtype,$fullrefname,$reftail) = @_;
        print PREVIOUS "\n$objid $reftail .\n" or die $!;
     }, $real);
@@ -496,7 +497,7 @@ sub readupdates () {
        printdebug " upd.| $_\n";
        m/^(\S+) (\S+) (\S+)$/ or die "$_ ?";
        my ($old, $sha1, $refname) = ($1, $2, $3);
-       if ($refname =~ m{^refs/tags/(?=$distro/)}) {
+       if ($refname =~ m{^refs/tags/(?=(?:archive/)?$distro/)}) {
            reject "pushing multiple tags!" if defined $tagname;
            $tagname = $'; #';
            $tagval = $sha1;
@@ -821,9 +822,16 @@ sub checks () {
     tagh1('object') eq $commit or reject "tag refers to wrong commit";
     tagh1('tag') eq $tagname or reject "tag name in tag is wrong";
 
-    my $expecttagname = debiantag_old $version, $distro;
-    printdebug "expected tag $expecttagname\n";
-    $tagname eq $expecttagname or die;
+    my @expecttagnames = debiantags($version, $distro);
+    printdebug "expected tag @expecttagnames\n";
+    grep { $tagname eq $_ } @expecttagnames or die;
+
+    foreach my $othertag (grep { $_ ne $tagname } @expecttagnames) {
+       reject "tag $othertag (pushed with differing dgit version)".
+           " already exists -".
+           " not replacing previously-pushed version"
+           if git_get_ref "refs/tags/".$othertag;
+    }
 
     lockrealtree();