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/RepoGitLog.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/RepoGitLog.pm') diff --git a/lib/PublicInbox/RepoGitLog.pm b/lib/PublicInbox/RepoGitLog.pm index b759a5c0..4e0997e0 100644 --- a/lib/PublicInbox/RepoGitLog.pm +++ b/lib/PublicInbox/RepoGitLog.pm @@ -128,16 +128,17 @@ sub call_git_log { $max = 50 if $max == 0; my $env = $req->{env}; my $git = $repo->{git}; + my $tip = $req->{-repo}->tip; my $cmd = $git->cmd(qw(log --no-notes --no-color --abbrev-commit), $git->abbrev, $LOG_FMT, "-$max", - $req->{-tip}, '--'); + $tip, '--'); my $rdr = { 2 => $git->err_begin }; my $title = "log: $repo->{repo}"; if (defined $h) { $title .= ' ('. utf8_html($h). ')'; $req->{lpfx} = $req->{relcmd}; } else { - $req->{lpfx} = $req->{relcmd}.$req->{-tip}; + $req->{lpfx} = $req->{relcmd} . $tip; } $req->{lhtml} = $self->html_start($req, $title) . "\n\n"; my $qsp = PublicInbox::Qspawn->new($cmd, undef, $rdr); -- cgit v1.2.3-24-ge0c7