]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: minor style cleanups
authorEric Wong <e@80x24.org>
Fri, 17 Feb 2017 23:40:37 +0000 (23:40 +0000)
committerEric Wong <e@80x24.org>
Fri, 17 Feb 2017 23:41:34 +0000 (23:41 +0000)
Avoid using '=>' arrow notation for arrays and array references,
it is confusing and more verbose.  Additionally, combine
"use constant" statements when possible.

lib/PublicInbox/RepoBase.pm
lib/PublicInbox/RepoGitBlob.pm
lib/PublicInbox/RepoGitCommit.pm
lib/PublicInbox/RepoGitSummary.pm
lib/PublicInbox/Repobrowse.pm

index 8c5f5c9d22b268843beab7a58db80bf6504c4d00..9876cf2a01e15648edbf3ad32f5a3b880d5a7884 100644 (file)
@@ -16,7 +16,7 @@ sub call {
                my $sub = "call_${vcs}_$cmd";
                $self->$sub($req);
        };
-       $@ ? [ 500, ['Content-Type'=>'text/plain'], [] ] : $rv;
+       $@ ? [ 500, ['Content-Type''text/plain'], [] ] : $rv;
 }
 
 sub mime_load {
index b535b0ad79aade3cb38c4d6b923eef4f70dd7504..84f48c656d881aff28680d821c9a9fe064324a25 100644 (file)
@@ -56,8 +56,8 @@ sub git_blob_stream_response {
                my ($res) = @_;
                my $to_read = 8192;
                eval {
-                       my $fh = $res->([ 200, ['Content-Length' => $size,
-                                               'Content-Type' => $type]]);
+                       my $fh = $res->([ 200, ['Content-Length', $size,
+                                               'Content-Type', $type]]);
                        $fh->write($buf) if defined $buf;
                        while ($left > 0) {
                                $to_read = $left if $to_read > $left;
index 1a10b13cd2177bf02d625ecb0c78f50ff95e92ba..2d4234cc1a490bfc872a94d30011e61365202bca 100644 (file)
@@ -20,12 +20,13 @@ use PublicInbox::RepoGit qw(git_unquote git_commit_title);
 use PublicInbox::RepoGitDiffCommon;
 use PublicInbox::Qspawn;
 
-use constant GIT_FMT => '--pretty=format:'.join('%n',
-       '%H', '%h', '%s', '%an <%ae>', '%ai', '%cn <%ce>', '%ci',
-       '%t', '%p', '%D', '%b%x00');
-
-use constant CC_EMPTY => " This is a merge, and the combined diff is empty.\n";
-use constant CC_MERGE => " This is a merge, showing combined diff:\n\n";
+use constant {
+       GIT_FMT => '--pretty=format:'.join('%n',
+               '%H', '%h', '%s', '%an <%ae>', '%ai', '%cn <%ce>', '%ci',
+               '%t', '%p', '%D', '%b%x00'),
+       CC_EMPTY => " This is a merge, and the combined diff is empty.\n",
+       CC_MERGE => " This is a merge, showing combined diff:\n\n"
+};
 
 sub commit_header {
        my ($self, $req) = @_;
@@ -155,7 +156,7 @@ sub git_commit_404 {
        $x .= "<a\nhref=\"$pfx\">$try the latest commit in HEAD</a>\n";
        $x .= '</pre></body>';
 
-       [404, ['Content-Type'=>'text/html'], [ $x ]];
+       [404, ['Content-Type''text/html'], [ $x ]];
 }
 
 # FIXME: horrifically expensive...
index 38fce1f5151e57776199627c1653204cfaa5fdb7..5eb8087de36657097d2f083372cfd2a30118bec6 100644 (file)
@@ -32,7 +32,7 @@ sub for_each_ref {
        my $refs = $git->popen(qw(for-each-ref --sort=-creatordate),
                                EACH_REF_FMT, "--count=$count",
                                qw(refs/heads/ refs/tags/));
-       $fh = $res->([200, ['Content-Type'=>'text/html; charset=UTF-8']]);
+       $fh = $res->([200, ['Content-Type''text/html; charset=UTF-8']]);
        # ref names are unpredictable in length and requires tables :<
        $fh->write($self->html_start($req,
                                "$repo->{repo}: overview") .
index 867785141f78217fee4782c27c35114221d74036..6fc060ae3f0792c2af0b00b35731e9d528285419 100644 (file)
@@ -73,7 +73,7 @@ sub no_tslash {
        }
        my $url = $base . $uri . $qs;
        [ 301,
-         [ Location => $url, 'Content-Type' => 'text/plain' ],
+         [ 'Location', $url, 'Content-Type', 'text/plain' ],
          [ "Redirecting to $url\n" ] ]
 }