chiark / gitweb /
git fetching: git_lrfetch_sane: Tidy up old suite-based refs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Jan 2017 00:20:21 +0000 (00:20 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Jan 2017 13:08:31 +0000 (13:08 +0000)
We should look for these and delete them, when we have the chance,
because otherwise nothing ever would.

For now we just use $csuite if we have it, and otherwise do nothing.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index 1fdc26c13b0d3a379f8950460df11783665a3521..8c9765e38c39658e3bb776f4a365080f800bd1e8 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2673,6 +2673,16 @@ END
        }
        last;
     }
        }
        last;
     }
+
+    if (defined $csuite) {
+       printdebug "git_lrfetch_sane: tidying any old suite lrfetchrefs\n";
+       git_for_each_ref("refs/dgit-fetch/$csuite", sub {
+           my ($objid,$objtype,$lrefname,$reftail) = @_;
+           next if $lrfetchrefs_f{$lrefname}; # $csuite eq $distro ?
+           runcmd_ordryrun_local @git, qw(update-ref -d), $lrefname;
+       });
+    }
+
     printdebug "git_lrfetch_sane: git fetch --no-insane emulation complete\n",
        Dumper(\%lrfetchrefs_f);
 }
     printdebug "git_lrfetch_sane: git fetch --no-insane emulation complete\n",
        Dumper(\%lrfetchrefs_f);
 }