From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CFE2F211B5; Wed, 19 Dec 2018 09:50:57 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Yaron Scheffer Subject: [ssoma PATCH 1/2] extractor: warn about v2 repositories Date: Wed, 19 Dec 2018 09:50:56 +0000 Message-Id: <20181219095057.21862-2-e@80x24.org> In-Reply-To: <20181219095057.21862-1-e@80x24.org> References: <20181219095057.21862-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: ssoma was a misguided effort and won't be updated to support v2, but at least spit out a warning about v2 repos. Reported-by: Yaron Scheffer --- lib/Ssoma/Extractor.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Ssoma/Extractor.pm b/lib/Ssoma/Extractor.pm index baf9adb..5c10eec 100644 --- a/lib/Ssoma/Extractor.pm +++ b/lib/Ssoma/Extractor.pm @@ -28,6 +28,17 @@ sub _flist { \@rv } +sub warn_v2 { + my ($self) = @_; + if (system('git cat-file blob HEAD:m >/dev/null 2>&1') == 0 || + system('git cat-file blob HEAD:d >/dev/null 2>&1') == 0) { + warn <<""; +$self->{git}->{git_dir} looks like a public-inbox v2 repo. +ssoma is deprecated and does not support v2 repositories + + } +} + sub _extract { my ($self, $target, $since) = @_; my $git = $self->{git}; @@ -82,11 +93,16 @@ sub _extract { # tricking us into extracting the same message twice; # MDA will keep the original in sufficiently-identical messages my $cmd = "git diff-tree -r --name-only -M100% --diff-filter=A"; - $new = _flist("$cmd $last $tip"); + $new = []; + if ($last ne $tip) { + $new = _flist("$cmd $last $tip"); + warn_v2($self) unless scalar(@$new); + } } else { # new maildir or mbox (to us), import everything in the # current tree $new = _flist("git ls-tree -r --name-only $tip"); + warn_v2($self) unless scalar(@$new); } my $i = 0; -- EW