From 6158b3e3476cd49a2e6c32fad88a7905ec88de8f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Feb 2017 03:01:24 +0000 Subject: repobrowse: fixup revision handling Revisions passed in the URL must not be ignored. This fixes some bugs introduced in commit f6244586ba4f5a5e7575e1254be8c9bbe303fce9 ("repobrowse: switch to new URL format to avoid query strings") --- lib/PublicInbox/RepoGitTree.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/PublicInbox/RepoGitTree.pm') diff --git a/lib/PublicInbox/RepoGitTree.pm b/lib/PublicInbox/RepoGitTree.pm index 5e880ee3..64ab9e6f 100644 --- a/lib/PublicInbox/RepoGitTree.pm +++ b/lib/PublicInbox/RepoGitTree.pm @@ -22,7 +22,7 @@ sub call_git_tree { my @extra = @{$req->{extra}}; my $repo = $req->{-repo}; my $git = $repo->{git}; - my $tip = $repo->tip; + my $tip = $req->{tip} || $repo->tip; my $obj = "$tip:$req->{expath}"; my ($hex, $type, $size) = $git->check($obj); @@ -31,8 +31,7 @@ sub call_git_tree { } my $opts = { nofollow => 1 }; - my $title = $req->{expath}; - $title = $title eq '' ? 'tree' : utf8_html($title); + my $title = "tree: ".utf8_html($req->{expath}); if ($type eq 'tree') { $opts->{noindex} = 1; $req->{thtml} = $self->html_start($req, $title, $opts) . "\n"; @@ -193,8 +192,8 @@ sub git_tree_show { $req->{thtml} .= "\npath: $t\n\nmode\tsize\tname\n"; if (defined(my $last = $req->{extra}->[-1])) { $pfx = PublicInbox::Hval->utf8($last)->as_path; - } elsif (defined $req->{h}) { - $pfx = $req->{-repo}->tip; + } elsif (defined(my $tip = $req->{tip})) { + $pfx = $tip; } else { $pfx = 'tree/' . $req->{-repo}->tip; } -- cgit v1.2.3-24-ge0c7