From: Ian Jackson Date: Sun, 17 Jul 2016 14:14:00 +0000 (+0100) Subject: Tag change: Update dgit-repos-server X-Git-Tag: archive/debian/2.0~244 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=349b41c2bded6dea53dd947e4ee5c16867b6d055 Tag change: Update dgit-repos-server 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 --- diff --git a/TODO.BRANCH b/TODO.BRANCH index b2908422..defdeeef 100644 --- a/TODO.BRANCH +++ b/TODO.BRANCH @@ -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 diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index 3c873419..f7d1b045 100755 --- a/infra/dgit-repos-server +++ b/infra/dgit-repos-server @@ -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();