user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/2] lei blob: support "lei index"-ed mail
  2021-05-05 10:46  5% [PATCH 0/2] lei rediff + solver-related fix Eric Wong
@ 2021-05-05 10:46  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-05-05 10:46 UTC (permalink / raw)
  To: meta

Normal git retrieval don't work for Maildir blobs indexed using
"lei index".  Fortunately, this oddness is limited to the
LeiStore class and we can override smsg_eml with a fallback
to read blobs from Maildirs.
---
 lib/PublicInbox/LeiSearch.pm | 10 ++++++++++
 t/solver_git.t               | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/lib/PublicInbox/LeiSearch.pm b/lib/PublicInbox/LeiSearch.pm
index cd28a700..c2b12146 100644
--- a/lib/PublicInbox/LeiSearch.pm
+++ b/lib/PublicInbox/LeiSearch.pm
@@ -144,4 +144,14 @@ sub lms {
 	-f $f ? PublicInbox::LeiMailSync->new($f) : undef;
 }
 
+# allow SolverGit->resolve_patch to work with "lei index"
+sub smsg_eml {
+	my ($self, $smsg) = @_;
+	PublicInbox::Inbox::smsg_eml($self, $smsg) // do {
+		my $lms = lms($self);
+		my $bref = $lms ? $lms->local_blob($smsg->{blob}, 1) : undef;
+		$bref ? PublicInbox::Eml->new($bref) : undef;
+	};
+}
+
 1;
diff --git a/t/solver_git.t b/t/solver_git.t
index e566efb3..44cbbfdb 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -27,6 +27,11 @@ my $ibx = create_inbox 'v2', version => 2,
 	$im->add(eml_load 't/solve/0001-simple-mod.patch') or BAIL_OUT;
 	$im->add($patch2) or BAIL_OUT;
 };
+my $md = "$tmpdir/md";
+File::Path::mkpath([map { $md.$_ } (qw(/ /cur /new /tmp))]);
+symlink(abs_path('t/solve/0001-simple-mod.patch'), "$md/cur/foo:2,") or
+	xbail "symlink: $!";
+
 my $v1_0_0_tag = 'cb7c42b1e15577ed2215356a2bf925aef59cdd8d';
 my $v1_0_0_tag_short = substr($v1_0_0_tag, 0, 16);
 my $expect = '69df7d565d49fbaaeb0a067910f03dc22cd52bd0';
@@ -70,6 +75,11 @@ test_lei({tmpdir => "$tmpdir/rediff"}, sub {
 		'got more context with -U9');
 });
 
+test_lei({tmpdir => "$tmpdir/index-eml-only"}, sub {
+	lei_ok(qw(index), $md);
+	lei_ok(qw(blob 69df7d5)); # hits LeiSearch->smsg_eml -> lms->local_blob
+});
+
 my $git = PublicInbox::Git->new($git_dir);
 $ibx->{-repo_objs} = [ $git ];
 my $res;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] lei rediff + solver-related fix
@ 2021-05-05 10:46  5% Eric Wong
  2021-05-05 10:46  7% ` [PATCH 2/2] lei blob: support "lei index"-ed mail Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-05-05 10:46 UTC (permalink / raw)
  To: meta

"rediff" is something I've wanted in the WWW UI for several
years, however:

1) the amount of git-diff options is staggering and
   I find HTML <form> elements difficult-to-use

2) git-diff can be monumentally expensive, on top of
   being difficult/impossible to cache

..so I couldn't figure out a good way to support it

On a local system, we can feed "git diff" command-line options
and not worry about 10K users trying to regenerate diffs at
once.

Eric Wong (2):
  lei rediff: regenerate diffs from stdin
  lei blob: support "lei index"-ed mail

 MANIFEST                     |   1 +
 lib/PublicInbox/Inbox.pm     |   2 +-
 lib/PublicInbox/LEI.pm       |  22 ++++
 lib/PublicInbox/LeiInput.pm  |   6 +
 lib/PublicInbox/LeiRediff.pm | 245 +++++++++++++++++++++++++++++++++++
 lib/PublicInbox/LeiSearch.pm |  10 ++
 t/solver_git.t               |  18 ++-
 7 files changed, 302 insertions(+), 2 deletions(-)
 create mode 100644 lib/PublicInbox/LeiRediff.pm

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-05-05 10:46  5% [PATCH 0/2] lei rediff + solver-related fix Eric Wong
2021-05-05 10:46  7% ` [PATCH 2/2] lei blob: support "lei index"-ed mail 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).