diff options
-rwxr-xr-x | infra/dgit-repos-server | 12 | ||||
-rwxr-xr-x | tests/tests/drs-push-rejects | 5 |
2 files changed, 16 insertions, 1 deletions
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index f5dd5aa..e2bec01 100755 --- a/infra/dgit-repos-server +++ b/infra/dgit-repos-server @@ -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(); diff --git a/tests/tests/drs-push-rejects b/tests/tests/drs-push-rejects index df90d22..5f6d04a 100755 --- a/tests/tests/drs-push-rejects +++ b/tests/tests/drs-push-rejects @@ -160,7 +160,12 @@ 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 |