about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-03-11 19:40:12 +0000
committerEric Wong <e@80x24.org>2024-03-12 06:18:19 +0000
commitc29d8743c68b06e980a4d6f04dc5e4682793e04d (patch)
tree26dda7da9c6e19cd3523deaa91c7def1871e45ba
parent298b05cef615ae3d3f1323e805fe135ae5138144 (diff)
downloadpublic-inbox-c29d8743c68b06e980a4d6f04dc5e4682793e04d.tar.gz
codesearch: deduplicate $git->{nick} field
While PublicInbox::Config is responsible for some instances of
setting $git->{nick}, more PublicInbox::Git objects may be
created from loading the cindex and we should do our best to
reuse that memory, too.

Followup-to: 84ed7ec1c887 (dedupe inbox names, coderepo nicks + git dirs, 2024-03-04)
-rw-r--r--lib/PublicInbox/CodeSearch.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/CodeSearch.pm b/lib/PublicInbox/CodeSearch.pm
index 48033bb5..e5fa4480 100644
--- a/lib/PublicInbox/CodeSearch.pm
+++ b/lib/PublicInbox/CodeSearch.pm
@@ -283,7 +283,8 @@ EOM
                 $nick =~ s!$lre!$nick_pfx!s or next;
                 $dir2cr{$p} = $coderepos->{$nick} //= do {
                         my $git = PublicInbox::Git->new($p);
-                        $git->{nick} = $nick; # for git->pub_urls
+                        my %dedupe = ($nick => undef);
+                        ($git->{nick}) = keys %dedupe; # for git->pub_urls
                         $git;
                 };
         }