chiark / gitweb /
Dgit.pm: git_for_each_tag_referring provides referred-to object id too
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:59:48 +0000 (11:59 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:59:48 +0000 (11:59 +0100)
Debian/Dgit.pm
dgit
infra/dgit-repos-server

index f20f1bc..a53cb82 100644 (file)
@@ -200,14 +200,18 @@ sub git_for_each_ref ($$) {
 
 sub git_for_each_tag_referring ($$) {
     my ($objreferring, $func) = @_;
-    # calls $func->($objid,$fullrefname,$tagname);
+    # calls $func->($tagobjid,$refobjid,$fullrefname,$tagname);
     printdebug "git_for_each_tag_referring ",
         ($objreferring // 'UNDEF'),"\n";
     git_for_each_ref('refs/tags', sub {
-       my ($objid,$objtype,$fullrefname,$tagname) = @_;
+       my ($tagobjid,$objtype,$fullrefname,$tagname) = @_;
        return unless $objtype eq 'tag';
-       return if defined $objreferring and $objid ne $objreferring;
-       $func->($objid,$fullrefname,$tagname);
+       my $refobjid = git_rev_parse $tagobjid;
+       return unless
+           !defined $objreferring # caller wants them all
+           or $tagobjid eq $objreferring
+           or $refobjid eq $objreferring;
+       $func->($tagobjid,$refobjid,$fullrefname,$tagname);
     });
 }
 
diff --git a/dgit b/dgit
index 9b401a2..1e348f3 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1667,7 +1667,7 @@ sub dopush ($) {
 
     if ($forceflag && defined $lastpush_hash) {
        git_for_each_tag_referring($lastpush_hash, sub {
-           my ($objid,$fullrefname,$tagname) = @_;
+           my ($objid,$refobjid,$fullrefname,$tagname) = @_;
            responder_send_command("supersedes $fullrefname=$objid");
            $supersedes{$fullrefname} = $objid;
        });
index 2616406..f700df8 100755 (executable)
@@ -680,7 +680,7 @@ sub checktagnoreplay () {
     my @problems;
 
     git_for_each_tag_referring($onlyreferring, sub {
-       my ($objid,$fullrefname,$tagname) = @_;
+       my ($objid,$refobjid,$fullrefname,$tagname) = @_;
        printdebug "checktagnoreplay - overwriting $fullrefname=$objid\n";
        my $supers = $supersedes{$fullrefname};
        if (!defined $supers) {