dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] WIP-join
Date: Mon, 12 Feb 2024 11:02:07 +0000	[thread overview]
Message-ID: <20240212110207.1253006-1-e@80x24.org> (raw)

---
 lib/PublicInbox/CodeSearch.pm    | 16 +++++++++++++++-
 lib/PublicInbox/CodeSearchIdx.pm |  5 +++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/CodeSearch.pm b/lib/PublicInbox/CodeSearch.pm
index 1f95a726..96732c79 100644
--- a/lib/PublicInbox/CodeSearch.pm
+++ b/lib/PublicInbox/CodeSearch.pm
@@ -227,7 +227,7 @@ BUG? (non-fatal) `$git_dir' not indexed in $self->{topdir}
 	@ret;
 }
 
-sub paths2roots {
+sub paths2roots { # for diagnostics
 	my ($self, $paths) = @_;
 	my %ret;
 	if ($paths) {
@@ -243,6 +243,20 @@ sub paths2roots {
 	\%ret;
 }
 
+sub basename_roots { # for diagnostics
+	my ($self, $paths) = @_;
+	my $tmp = paths2roots($self, $paths);
+	my $ret = {};
+	while (my ($git_dir, $roots) = each %$tmp) {
+		my $bn = substr($git_dir, rindex($git_dir, '/') + 1);
+		++$ret->{$bn}->{$_} for @$roots;
+	}
+	# for my $bn (keys %$ret) {
+		# $ret->{$bn}
+	# }
+	$ret;
+}
+
 sub load_ct { # retry_reopen cb
 	my ($self, $git_dir) = @_;
 	my @ids = docids_of_git_dir $self, $git_dir or return;
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 570ff64f..91c0146b 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -1250,10 +1250,11 @@ sub show_json { # for diagnostics (unstable output)
 	my %ret;
 	my @todo = @$s;
 	while (defined(my $f = shift @todo)) {
-		if ($f =~ /\A(?:roots2paths|paths2roots|join_data)\z/) {
+		if ($f =~ /\A(?:roots2paths|paths2roots|join_data|
+				basename_roots)\z/x) {
 			$ret{$f} = $self->$f;
 		} elsif ($f eq '') { # default --show (no args)
-			push @todo, qw(roots2paths join_data);
+			push @todo, qw(basename_roots join_data);
 		} else {
 			warn "E: cannot show `$f'\n";
 		}

             reply	other threads:[~2024-02-12 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 11:02 Eric Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-20  6:11 [PATCH] WIP-join Eric Wong

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

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

  git send-email \
    --in-reply-to=20240212110207.1253006-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.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.
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).