From e7dc3224ad0b497da6ef242e3a9c612c5702514e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 16 Feb 2017 23:26:01 +0000 Subject: repobrowse: memoize git symbolic-ref resolution The "HEAD" symbolic ref is rarely changed, so memoize it for now and avoid exposing it in URLs. --- lib/PublicInbox/RepoGitBlob.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/RepoGitBlob.pm') diff --git a/lib/PublicInbox/RepoGitBlob.pm b/lib/PublicInbox/RepoGitBlob.pm index ca8a3c2f..b535b0ad 100644 --- a/lib/PublicInbox/RepoGitBlob.pm +++ b/lib/PublicInbox/RepoGitBlob.pm @@ -11,8 +11,9 @@ our @EXPORT = qw(git_blob_mime_type git_blob_stream_response); sub call_git_blob { my ($self, $req) = @_; - my $git = $req->{-repo}->{git}; - my $id = $req->{-tip} . ':' . $req->{expath}; + my $repo = $req->{-repo}; + my $git = $repo->{git}; + my $id = $repo->tip . ':' . $req->{expath}; my ($cat, $hex, $type, $size) = $git->cat_file_begin($id); return unless defined $cat; -- cgit v1.2.3-24-ge0c7