From b3623ed3c06aa4ac2e47378d3c948c35a6809efa Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 13 Jan 2017 22:53:20 +0000 Subject: repobrowse: simplify conditional for cat-file input expath is always defined, even to an empty string, so simplify the conditional for checking it. --- lib/PublicInbox/RepobrowseGitBlob.pm | 4 +--- lib/PublicInbox/RepobrowseGitPlain.pm | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/PublicInbox/RepobrowseGitBlob.pm b/lib/PublicInbox/RepobrowseGitBlob.pm index d38101ed..a11c457c 100644 --- a/lib/PublicInbox/RepobrowseGitBlob.pm +++ b/lib/PublicInbox/RepobrowseGitBlob.pm @@ -15,10 +15,8 @@ sub call_git_blob { my $q = PublicInbox::RepobrowseGitQuery->new($req->{env}); my $id = $q->{id}; $id eq '' and $id = 'HEAD'; + $id .= ":$req->{expath}"; - if (length(my $expath = $req->{expath})) { - $id .= ":$expath"; - } my ($cat, $hex, $type, $size) = $git->cat_file_begin($id); return unless defined $cat; diff --git a/lib/PublicInbox/RepobrowseGitPlain.pm b/lib/PublicInbox/RepobrowseGitPlain.pm index c59993fe..c985173c 100644 --- a/lib/PublicInbox/RepobrowseGitPlain.pm +++ b/lib/PublicInbox/RepobrowseGitPlain.pm @@ -13,12 +13,7 @@ sub call_git_plain { my $q = PublicInbox::RepobrowseGitQuery->new($req->{env}); my $id = $q->{id}; $id eq '' and $id = 'HEAD'; - - if (length(my $expath = $req->{expath})) { - $id .= ":$expath"; - } else { - $id .= ':'; - } + $id .= ":$req->{expath}"; my ($cat, $hex, $type, $size) = $git->cat_file_begin($id); return unless defined $cat; -- cgit v1.2.3-24-ge0c7