]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: avoid empty pathspecs for future git compatibility
authorEric Wong <e@80x24.org>
Mon, 26 Dec 2016 03:04:08 +0000 (03:04 +0000)
committerEric Wong <e@80x24.org>
Sun, 1 Jan 2017 03:07:31 +0000 (03:07 +0000)
At the moment, we always set expath, so it will always be
defined.

lib/PublicInbox/RepobrowseGitDiff.pm

index d65973c1a5157b05f4b3ee74a2df34aa9bd3ccb2..4ed4d02e02a3ac02f4c273b9a66fad98ea3f0125 100644 (file)
@@ -28,7 +28,7 @@ sub call_git_diff {
                        --no-notes --no-color -M -B -D -r),
                        $id2, $id, '--');
        my $expath = $req->{expath};
-       push @cmd, $expath if defined $expath;
+       push @cmd, $expath if $expath ne '';
        $req->{rpipe} = $git->popen(\@cmd, undef, { 2 => $git->err_begin });
        my $env = $req->{env};
        my $err = $env->{'psgi.errors'};
@@ -72,7 +72,7 @@ sub call_git_diff {
                        my $h = ['Content-Type', 'text/html; charset=UTF-8'];
                        my $fh = $req->{fh} = $res->([200, $h]);
                        my $o = { nofollow => 1, noindex => 1 };
-                       my $ex = defined $expath ? " $expath" : '';
+                       my $ex = $expath eq '' ? '' : " $expath";
                        $fh->write($self->html_start($req, 'diff', $o).
                                        "\n\n".
                                        utf8_html("git diff-tree -r -M -B -D ".