diff options
author | Eric Wong <e@80x24.org> | 2016-03-29 20:30:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-05 18:58:27 +0000 |
commit | 94cc38f30d6442493be8581ce9f52cc07e1b7d3a (patch) | |
tree | 0ad55c9766f071d23790ff4e25d08c0cf959021a /lib/PublicInbox/RepobrowseGitDiff.pm | |
parent | 7f72ab0d9ab18642ed9fc0546a56bd6e1e11820b (diff) | |
download | public-inbox-94cc38f30d6442493be8581ce9f52cc07e1b7d3a.tar.gz |
This will make it easier to show how the diff output was generated and hopefully teach users to use the git command-line.
Diffstat (limited to 'lib/PublicInbox/RepobrowseGitDiff.pm')
-rw-r--r-- | lib/PublicInbox/RepobrowseGitDiff.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/PublicInbox/RepobrowseGitDiff.pm b/lib/PublicInbox/RepobrowseGitDiff.pm index 8e535708..8c349e9b 100644 --- a/lib/PublicInbox/RepobrowseGitDiff.pm +++ b/lib/PublicInbox/RepobrowseGitDiff.pm @@ -27,9 +27,8 @@ sub call_git_diff { my @cmd = (qw(diff-tree -z --numstat -p --encoding=UTF-8 --no-notes --no-color -M -B -D -r), $id2, $id, '--'); - if (defined(my $expath = $req->{expath})) { - push @cmd, $expath; - } + my $expath = $req->{expath}; + push @cmd, $expath if defined $expath; $req->{rpipe} = $git->popen(\@cmd, undef, { 2 => $git->err_begin }); my $env = $req->{cgi}->env; my $err = $env->{'psgi.errors'}; @@ -74,7 +73,11 @@ 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 }; - $fh->write($self->html_start($req, 'diff', $o)."\n"); + my $ex = defined $expath ? " $expath" : ''; + $fh->write($self->html_start($req, 'diff', $o). + "\n\n". + utf8_html("git diff-tree -r -M -B -D ". + "$id2 $id --$ex"). "\n\n"); } if (my $fh = $req->{fh}) { git_diff_to_html($req, $fh); |