unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] import: maintain ssoma.index unconditionally
@ 2016-04-15 23:27 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-04-15 23:27 UTC (permalink / raw)
  To: meta

We must maintain the ssoma.index for future updates/incremental
imports since we (ssoma and public-inbox) always work without a
working tree.  git-fast-import is great for mass imports, but
the packs generated by git-fast-import are extremely bad when
used with -mda (one pack per-message) and it's not trivial
to separate good packs from bad, unoptimized packs during
"git gc".
---
 lib/PublicInbox/Import.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 7073c3d..fe2eb39 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -193,6 +193,18 @@ sub done {
 	my $pid = delete $self->{pid} or die 'BUG: missing {pid} when done';
 	waitpid($pid, 0) == $pid or die 'fast-import did not finish';
 	$? == 0 or die "fast-import failed: $?";
+
+	# for compatibility with existing ssoma installations and
+	# for future incremental imports
+	{
+		my $git_dir = $self->{git}->{git_dir};
+		local $ENV{GIT_INDEX_FILE} = "$git_dir/ssoma.index";
+		system('git', "--git-dir=$git_dir", qw(read-tree -m -v -i),
+			$self->{ref}) == 0 or
+			die "failed to update $git_dir/ssoma.index: $?\n";
+	}
+
+
 	my $lockfh = delete $self->{lockfh} or die "BUG: not locked: $!";
 	flock($lockfh, LOCK_UN) or die "unlock failed: $!";
 	close $lockfh or die "close lock failed: $!";
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-15 23:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 23:27 [PATCH] import: maintain ssoma.index unconditionally Eric Wong

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).