chiark / gitweb /
Infra: Allow FRESHREPO to override "tag already exists"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 14:32:43 +0000 (15:32 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 14:46:56 +0000 (15:46 +0100)
drs-push-rejects test needs updating too.

infra/dgit-repos-server
tests/tests/drs-push-rejects

index f5dd5aa8bfdd564d328d464602cee6887fc9efe2..e2bec01e810b1dc512a2e7851a66934ae466282d 100755 (executable)
@@ -447,6 +447,8 @@ sub main__git_receive_pack () {
 our ($tagname, $tagval, $suite, $oldcommit, $commit);
 our ($version, %tagh);
 
+our ($tagexists_error);
+
 sub readupdates () {
     printdebug " updates ...\n";
     while (<STDIN>) {
@@ -458,7 +460,7 @@ sub readupdates () {
            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/}) {
@@ -781,6 +783,14 @@ sub checks () {
                    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();
 
index df90d22c2109403ec1a257869f8ad9f92c84c8e3..5f6d04a498792e43ef1c318693f31498ae9dfde7 100755 (executable)
@@ -159,8 +159,13 @@ prep unstable sid
 mktag
 mustsucceed $push_spec # succeeds
 
+mktag
+mustfail 'push is missing head ref update' $push_spec
+
+git commit --allow-empty -m 'Dummy update'
 mktag
 mustfail 'not replacing previously-pushed version' $push_spec
+git reset --hard HEAD~
 
 prep_dm_mangle () {
        prep unstable sid