From: Ian Jackson Date: Wed, 27 May 2015 20:36:15 +0000 (+0100) Subject: dgit: Declare a "supersedes" in the signed tag for all previous refs/heads and refs... X-Git-Tag: debian/0.30~126 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=2f611c6de222547a01d81d50dc5cfecb9fb7d277 dgit: Declare a "supersedes" in the signed tag for all previous refs/heads and refs/tags in the repo, when deliberately_not_fast_forward --- diff --git a/dgit b/dgit index 6e9c3044..c315c7f1 100755 --- a/dgit +++ b/dgit @@ -111,6 +111,8 @@ sub lref () { return "refs/heads/".lbranch(); } sub lrref () { return "refs/remotes/$remotename/".server_branch($csuite); } sub rrref () { return server_ref($csuite); } +sub lrfetchrefs () { return "refs/dgit-fetch/$isuite"; } + sub stripepoch ($) { my ($vsn) = @_; $vsn =~ s/^\d+\://; @@ -1261,6 +1263,11 @@ sub ensure_we_have_orig () { sub git_fetch_us () { runcmd_ordryrun_local @git, qw(fetch),access_giturl(),fetchspec(); + if (deliberately_not_fast_forward) { + runcmd_ordryrun_local @git, qw(fetch -p), access_giturl(), + map { "+refs/$_/*:".lrfetchrefs."/$_/*" } + qw(tags heads); + } } sub fetch_from_archive () { @@ -1653,11 +1660,12 @@ sub dopush ($) { responder_send_command("param head $head"); responder_send_command("param csuite $csuite"); - if ($forceflag && defined $lastpush_hash) { - git_for_each_tag_referring($lastpush_hash, sub { - my ($tagobjid,$refobjid,$fullrefname,$tagname) = @_; - responder_send_command("supersedes $fullrefname=$tagobjid"); - $supersedes{$fullrefname} = $tagobjid; + if ($forceflag) { + git_for_each_ref(lrfetchrefs, sub { + my ($objid,$objtype,$lrfetchrefname,$reftail) = @_; + my $rrefname= substr($lrfetchrefname, length(lrfetchrefs) + 1); + responder_send_command("supersedes $rrefname=$objid"); + $supersedes{$rrefname} = $objid; }); }