chiark / gitweb /
dgit-repos-server: tag2upload: Check the upstream tag syntax only once
[dgit.git] / infra / dgit-repos-server
index f1308da8e4eaaa418eac0ae86f102a2ba9499b71..f5767aefdeb0fe2f2ee9b24ba74dbdf806bff6e0 100755 (executable)
@@ -1149,7 +1149,6 @@ sub mode_tag2upload () {
 
     # This is for us.  From now on, we will capture errors to
     # be emailed to the tagger.
-    # TODO: failures to git fetch from salsa will burn a version
 
     open H, ">>dgit-tmp/tagupl.email" or die $!;
     print H <<END or die $!;
@@ -1189,14 +1188,15 @@ END
                 -f$ENV{DGIT_DRS_EMAIL_NOREPLY}        \\
                 <tagupl.email
 END
-       exit 0;
+       $quit->("failed, emailed");
     }
 
     open STDERR, ">&L" or die $!;
     open STDOUT, ">&STDERR" or die $!;
     open DEBUG, ">&STDERR" if $debuglevel;
 
-    die "$tagmversion != $version " unless $tagmversion eq $version;
+    reject "version mismatch $tagmversion != $version "
+       unless $tagmversion eq $version;
 
     my %need = map { $_ => 1 } qw(please-upload split);
     my ($upstreamc, $upstreamt);
@@ -1224,15 +1224,15 @@ END
        $distro_ok ||= $gotdistro eq $distro;
     };
 
-    $quit->("other distro") unless $distro_ok;
+    $quit->("not for this distro") unless $distro_ok;
 
     reject "missing \"$_\"" foreach keys %need;
 
+    verifytag();
+
     reject "upstream tag and not commitish, or v-v"
        unless defined $upstreamt == defined $upstreamc;
 
-    verifytag();
-
     my @dgit;
     push @dgit, $ENV{DGIT_DRS_DGIT} // 'dgit';
     push @dgit, '-wn';
@@ -1244,7 +1244,6 @@ END
 
     my @fetch = qw(git fetch origin --unshallow);
     if (defined $upstreamt) {
-       runcmd qw(git check-ref-format), "refs/tags/$upstreamt";
        runcmd qw(git check-ref-format), "refs/tags/$upstreamt";
        my $utagref = "refs/tags/$upstreamt";
        push @fetch, "$utagref:$utagref";