]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mirror: properly pack-refs in non-forkgroup repos
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:32:02 +0000 (05:32 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:57 +0000 (23:38 +0000)
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

index 04d9494c604388ca4e9c0f832b9233c653cb9ac7..4464b6b109b9bc1884c6a3d1a8cd73d29980927f 100644 (file)
@@ -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});
 }