user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: meta@public-inbox.org
Subject: Re: [PATCH] Import.pm: When purging replace a purged file with a zero length file
Date: Fri, 10 Aug 2018 17:47:08 +0000	[thread overview]
Message-ID: <20180810174708.i5gnteidb6atyrzr@dcvr> (raw)
In-Reply-To: <87d0urt761.fsf@xmission.com>

"Eric W. Biederman" <ebiederm@xmission.com> wrote:
> 
> 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.

OK, definitely desirable.

> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
> ---
>  lib/PublicInbox/Import.pm | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
> index bfa7a8053297..3df7d98f298b 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+)/) {
> -- 

OK.  I haven't checked, but is the indexing/re-indexing code
able to deal with zero-byte messages?  Thanks.

  reply	other threads:[~2018-08-10 17:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  0:08 [PATCH] Import.pm: When purging replace a purged file with a zero length file Eric W. Biederman
2018-08-10 17:47 ` Eric Wong [this message]
2018-08-11  1:12   ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180810174708.i5gnteidb6atyrzr@dcvr \
    --to=e@80x24.org \
    --cc=ebiederm@xmission.com \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).