From: Eric W. Biederman Date: Fri, 10 Aug 2018 00:08:22 +0000 (-0500) Subject: Import.pm: When purging replace a purged file with a zero length file X-Git-Tag: v1.2.0~466 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a118d58a402bd31b;hp=ce5494b5b830e9b8b60815ccd81218390dc0d5db;p=public-inbox.git Import.pm: When purging replace a purged file with a zero length file This ensures that the number of added files remains the same and thus the article numbers derived from a repository will remain the same. I think this is the last place in public-inbox that has to be tweaked to guarantee the generated article number will remain the same in an public inbox archive. Signed-off-by: "Eric W. Biederman" --- diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index bfa7a805..3df7d98f 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -519,11 +519,12 @@ sub purge_oids { push @buf, $buf; } elsif (/^M 100644 ([a-f0-9]+) (\w+)/) { my ($oid, $path) = ($1, $2); + $tree->{$path} = 1; if ($purge->{$oid}) { push @oids, $oid; - delete $tree->{$path}; + my $cmd = "M 100644 inline $path\ndata 0\n\n"; + push @buf, $cmd; } else { - $tree->{$path} = 1; push @buf, $_; } } elsif (/^D (\w+)/) {