diff options
author | Eric Wong <e@80x24.org> | 2023-03-08 11:02:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-03-09 18:59:23 +0000 |
commit | b34cdf2c58754bf620badbaf30f5cecb0c11905c (patch) | |
tree | 68befc5a298e5fe96ad3e2540ebf7d410f45ab37 | |
parent | 0fa19f1a4b6949808c311312e80d9d3a5010cc23 (diff) | |
download | public-inbox-b34cdf2c58754bf620badbaf30f5cecb0c11905c.tar.gz |
Apparently, --no-write-fetch-head is broken in current git[1]. It also wasn't in older git, at all. So just unlink FETCH_HEAD as we see it, but keep using --no-write-fetch-head to avoid the syscall and I/O overhead when we can. [1] https://yhbt.net/lore/git/20230308100438.908471-1-e@80x24.org/
-rw-r--r-- | lib/PublicInbox/LeiMirror.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 87311198..c148ebfd 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -358,11 +358,18 @@ sub pack_refs { start_cmd($self, $cmd, { 2 => $self->{lei}->{2} }); } +sub unlink_fetch_head ($) { + my ($git_dir) = @_; + return if unlink("$git_dir/FETCH_HEAD") || $!{ENOENT}; + warn "W: unlink($git_dir/FETCH_HEAD): $!"; +} + sub fgrpv_done { my ($fgrpv) = @_; return if !$LIVE; my $first = $fgrpv->[0] // die 'BUG: no fgrpv->[0]'; return if !keep_going($first); + unlink_fetch_head($first->{-osdir}) if !$first->{dry_run}; pack_refs($first, $first->{-osdir}); # objstore refs always packed for my $fgrp (@$fgrpv) { my $rn = $fgrp->{-remote}; @@ -817,6 +824,7 @@ sub v1_done { # called via OnDestroy return if $self->{dry_run} || !keep_going($self); _write_inbox_config($self); my $dst = $self->{cur_dst} // $self->{dst}; + unlink_fetch_head($dst); update_ent($self) if $self->{-ent}; my $o = "$dst/objects"; if (open(my $fh, '<', my $fn = "$o/info/alternates")) {; |