diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-04 19:19:40 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-07-04 21:38:47 +0100 |
commit | 8c95b29b79a159e5153f51affece9cf9314b4d84 (patch) | |
tree | 9085eabb92eb0df989490ec546661a5bf04369ed /dgit | |
parent | e7cfaa23447394d52d83cf2d71636f6d41d4da72 (diff) |
dgit: Be more careful about tag updates during fetch: only update tags referring to uploads to distro we are trying to fetch from.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -1343,12 +1343,33 @@ 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); - } + my @specs = (fetchspec()); + push @specs, + map { "+refs/$_/*:".lrfetchrefs."/$_/*" } + qw(tags heads); + runcmd_ordryrun_local @git, qw(fetch -p -n), access_giturl(), @specs; + + my %here; + my $tagpat = debiantag('*',access_basedistro); + + git_for_each_ref("refs/tags/".$tagpat, sub { + my ($objid,$objtype,$fullrefname,$reftail) = @_; + printdebug "currently $fullrefname=$objid\n"; + $here{$fullrefname} = $objid; + }); + git_for_each_ref(lrfetchrefs."/tags/".$tagpat, sub { + my ($objid,$objtype,$fullrefname,$reftail) = @_; + my $lref = "refs".substr($fullrefname, length lrfetchrefs); + printdebug "offered $lref=$objid\n"; + if (!defined $here{$lref}) { + my @upd = (@git, qw(update-ref), $lref, $objid, ''); + runcmd_ordryrun_local @upd; + } elsif ($here{$lref} eq $objid) { + } else { + print STDERR \ + "Not updateting $lref from $here{$lref} to $objid.\n"; + } + }); } sub fetch_from_archive () { |