From 683b0eb026fa6b43cc0a9ae122764f9a5d031f59 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 31 May 2015 15:32:43 +0100 Subject: [PATCH 1/1] Infra: Allow FRESHREPO to override "tag already exists" drs-push-rejects test needs updating too. --- infra/dgit-repos-server | 12 +++++++++++- tests/tests/drs-push-rejects | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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 -- 2.30.2