]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: simplify conditional for cat-file input
authorEric Wong <e@80x24.org>
Fri, 13 Jan 2017 22:53:20 +0000 (22:53 +0000)
committerEric Wong <e@80x24.org>
Fri, 13 Jan 2017 22:53:20 +0000 (22:53 +0000)
expath is always defined, even to an empty string,
so simplify the conditional for checking it.

lib/PublicInbox/RepobrowseGitBlob.pm
lib/PublicInbox/RepobrowseGitPlain.pm

index d38101ed280821f5005c7d935c8861bdf9c7340b..a11c457ce9830bf4926ba50ca179fbc124acd4c3 100644 (file)
@@ -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;
 
index c59993fe95dbe0716502940a97614b34db2db316..c985173c73d0feef435ecfac61a042c5faa2937d 100644 (file)
@@ -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;