# POLICY-HOOK-SCRIPT ... push-confirm PACKAGE \
# VERSION SUITE TAGNAME DELIBERATELIES FRESH-REPO|'' [...]
#
+# DELIBERATELIES is like this: --deliberately-foo,--deliberately-bar,...
+#
# Exit status is a bitmask. Bit weight constants are defined in Dgit.pm.
# NOFFCHECK (2)
# suppress dgit-repos-server's fast-forward check ("push" only)
ensuredir "$dgitrepos/_removed-tags";
open PREVIOUS, ">>", removedtagsfile or die removedtagsfile." $!";
- git_for_each_ref(debiantag('*'), sub {
+ git_for_each_ref('refs/tags/'.debiantag('*'), sub {
my ($objid,$objtype,$fullrefname,$reftail) = @_;
print PREVIOUS "\n$objid $reftail .\n" or die $!;
}, $real);
our ($tagname, $tagval, $suite, $oldcommit, $commit);
our ($version, %tagh);
+our ($tagexists_error);
+
sub readupdates () {
printdebug " updates ...\n";
while (<STDIN>) {
reject "pushing multiple tags!" if defined $tagname;
$tagname = $'; #';
$tagval = $sha1;
- reject "tag $tagname already exists -".
+ $tagexists_error= "tag $tagname already exists -".
" not replacing previously-pushed version"
if $old =~ m/[^0]/;
} elsif ($refname =~ m{^refs/dgit/}) {
my ($tagobjid,$refobjid,$fullrefname,$tagname) = @_;
$check_ref_superseded->($tagobjid,undef,$fullrefname,undef);
});
- printdebug "checktagnoreply - not FRESHREPO, nchecked=$nchecked";
+ printdebug "checktagnoreplay - not FRESHREPO, nchecked=$nchecked";
push @problems, "does not supersede any tag".
" referring to branch head $branch=$branchhead"
unless $nchecked;
join("; ", @problems).
"\n";
}
- printdebug "checktagnoreply - all ok\n"
+ printdebug "checktagnoreplay - all ok ($tagval)\n"
}
sub tagh1 ($) {
join(",",@deliberatelies));
$policy = policyhook(NOFFCHECK|FRESHREPO, 'push', @policy_args);
+ if (defined $tagexists_error) {
+ if ($policy & FRESHREPO) {
+ printdebug "ignoring tagexists_error: $tagexists_error\n";
+ } else {
+ reject $tagexists_error;
+ }
+ }
+
checktagnoreplay();
checksuite();