From: Ian Jackson Date: Sun, 31 May 2015 14:32:43 +0000 (+0100) Subject: Infra: Allow FRESHREPO to override "tag already exists" X-Git-Tag: debian/0.30~117 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=683b0eb026fa6b43cc0a9ae122764f9a5d031f59 Infra: Allow FRESHREPO to override "tag already exists" drs-push-rejects test needs updating too. --- diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index f5dd5aa8..e2bec01e 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 () { @@ -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 df90d22c..5f6d04a4 100755 --- a/tests/tests/drs-push-rejects +++ b/tests/tests/drs-push-rejects @@ -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