We need to ensure `git update-ref --stdin' is complete
before running `git pack-refs', otherwise loose refs can
remain while update-ref is still running.
---
 lib/PublicInbox/LeiMirror.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 04d9494c..4464b6b1 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -315,7 +315,12 @@ sub fgrp_update {
                upr($lei, $w, 'create', $ref, $oid);
        }
        close($w) or warn "E: close(update-ref --stdin): $! (need git 
1.8.5+)\n";
-       $LIVE->{$pid} = [ \&reap_cmd, $fgrp, $cmd ];
+       my $pack = PublicInbox::OnDestroy->new($$, \&pack_dst, $fgrp);
+       $LIVE->{$pid} = [ \&reap_cmd, $fgrp, $cmd, $pack ];
+}
+
+sub pack_dst { # packs lightweight satellite repos
+       my ($fgrp) = @_;
        pack_refs($fgrp, $fgrp->{cur_dst});
 }
 

Reply via email to