]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
codesearch: deduplicate $git->{nick} field
authorEric Wong <e@80x24.org>
Mon, 11 Mar 2024 19:40:12 +0000 (19:40 +0000)
committerEric Wong <e@80x24.org>
Tue, 12 Mar 2024 06:18:19 +0000 (06:18 +0000)
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)
lib/PublicInbox/CodeSearch.pm

index 48033bb5489f9acb5d61ed0ae548d981c2b37790..e5fa4480afae336be269d9bc789e6573daa176ec 100644 (file)
@@ -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;
                };
        }