* [PATCH 1/4] content_hash: git_sha: allow unblessed SCALAR refs
2021-04-29 9:46 6% [PATCH 0/4] some lei synchronization work Eric Wong
@ 2021-04-29 9:46 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-04-29 9:46 UTC (permalink / raw)
To: meta
This will be convenient to avoid the overhead of
PublicInbox::Eml for verifying synchronization in lei.
---
lib/PublicInbox/ContentHash.pm | 6 +++---
lib/PublicInbox/LeiViewText.pm | 1 -
t/solver_git.t | 7 ++-----
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/PublicInbox/ContentHash.pm b/lib/PublicInbox/ContentHash.pm
index 112b1ea6..cc4a54c9 100644
--- a/lib/PublicInbox/ContentHash.pm
+++ b/lib/PublicInbox/ContentHash.pm
@@ -97,9 +97,9 @@ sub content_hash ($) {
sub git_sha ($$) {
my ($n, $eml) = @_;
my $dig = Digest::SHA->new($n);
- my $buf = $eml->as_string;
- $dig->add('blob '.length($buf)."\0");
- $dig->add($buf);
+ my $bref = ref($eml) eq 'SCALAR' ? $eml : \($eml->as_string);
+ $dig->add('blob '.length($$bref)."\0");
+ $dig->add($$bref);
$dig;
}
diff --git a/lib/PublicInbox/LeiViewText.pm b/lib/PublicInbox/LeiViewText.pm
index d0f8b7f4..340a6648 100644
--- a/lib/PublicInbox/LeiViewText.pm
+++ b/lib/PublicInbox/LeiViewText.pm
@@ -7,7 +7,6 @@ package PublicInbox::LeiViewText;
use strict;
use v5.10.1;
use PublicInbox::MsgIter qw(msg_part_text);
-use PublicInbox::ContentHash qw(git_sha);
use PublicInbox::MID qw(references);
use PublicInbox::View;
use PublicInbox::Hval;
diff --git a/t/solver_git.t b/t/solver_git.t
index 6875e26b..75387b2a 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -7,7 +7,6 @@ use PublicInbox::TestCommon;
use Cwd qw(abs_path);
require_git(2.6);
use PublicInbox::ContentHash qw(git_sha);
-use PublicInbox::Eml;
use PublicInbox::Spawn qw(popen_rd which);
require_mods(qw(DBD::SQLite Search::Xapian Plack::Util));
my $git_dir = xqx([qw(git rev-parse --git-dir)], undef, {2 => \(my $null)});
@@ -41,8 +40,7 @@ test_lei({tmpdir => $tmpdir}, sub {
"--mail won't run solver");
lei_ok('blob', '69df7d5', '-I', $ibx->{inboxdir});
- is(git_sha(1, PublicInbox::Eml->new($lei_out))->hexdigest,
- $expect, 'blob contents output');
+ is(git_sha(1, \$lei_out)->hexdigest, $expect, 'blob contents output');
my $prev = $lei_out;
lei_ok(qw(blob --no-mail 69df7d5 -I), $ibx->{inboxdir});
is($lei_out, $prev, '--no-mail works');
@@ -239,8 +237,7 @@ EOF
test_lei({tmpdir => "$tmpdir/ext"}, sub {
my $rurl = "$url/$name";
lei_ok(qw(blob --no-mail 69df7d5 -I), $rurl);
- my $eml = PublicInbox::Eml->new($lei_out);
- is(git_sha(1, $eml)->hexdigest, $expect,
+ is(git_sha(1, \$lei_out)->hexdigest, $expect,
'blob contents output');
ok(!lei(qw(blob -I), $rurl, $non_existent),
'non-existent blob fails');
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] some lei synchronization work
@ 2021-04-29 9:46 6% Eric Wong
2021-04-29 9:46 7% ` [PATCH 1/4] content_hash: git_sha: allow unblessed SCALAR refs Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-04-29 9:46 UTC (permalink / raw)
To: meta
2/4 is a fairly big change to recent-ish behavior; but ought to
help us avoid problems by avoiding mismatched sources of truth.
-watch once again halts on UIDVALIDITY changes (matching <=1.6
behavior).
Tor .onion URLs for NNTP and IMAP also aren't supported unless
the entire lei-daemon process is running under torsocks.
Net::NNTP doesn't seem to have provisions for using
user-supplied classes like IO::Socket::SOCKS, either.
Mail::IMAPClient supports ->Socket and ->RawSocket, at least...
Eric Wong (4):
content_hash: git_sha: allow unblessed SCALAR refs
lei import: avoid IMAPTracker, use LeiMailSync more
lei import: support UIDVALIDITY in IMAP URL
lei import: support shell completion of known folders
Documentation/lei-store-format.pod | 2 +-
contrib/completion/lei-completion.bash | 1 +
lib/PublicInbox/ContentHash.pm | 6 +--
lib/PublicInbox/IMAPTracker.pm | 35 +++++---------
lib/PublicInbox/LEI.pm | 2 +-
lib/PublicInbox/LeiExternal.pm | 22 +++++----
lib/PublicInbox/LeiImport.pm | 20 ++++----
lib/PublicInbox/LeiInput.pm | 20 +++++---
lib/PublicInbox/LeiMailSync.pm | 2 +-
lib/PublicInbox/LeiUp.pm | 4 +-
lib/PublicInbox/LeiViewText.pm | 1 -
lib/PublicInbox/NetReader.pm | 67 +++++++++++++++++---------
lib/PublicInbox/URIimap.pm | 2 +
t/lei-import-imap.t | 8 ++-
t/lei-import-nntp.t | 4 +-
t/solver_git.t | 7 +--
16 files changed, 112 insertions(+), 91 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-04-29 9:46 6% [PATCH 0/4] some lei synchronization work Eric Wong
2021-04-29 9:46 7% ` [PATCH 1/4] content_hash: git_sha: allow unblessed SCALAR refs Eric Wong
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).