diff options
author | Eric Wong <e@80x24.org> | 2015-12-24 11:35:41 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-05 18:58:27 +0000 |
commit | 4be6ef4cf0d38a45fc22f0d92ab24e0b04639030 (patch) | |
tree | d0bd21d097f27a9c89c505644a32d790d6e39ca9 /lib | |
parent | fcbef01679483e729518e01ca9393c23a284194d (diff) | |
download | public-inbox-4be6ef4cf0d38a45fc22f0d92ab24e0b04639030.tar.gz |
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/RepoBrowseGitCommit.pm | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/PublicInbox/RepoBrowseGitCommit.pm b/lib/PublicInbox/RepoBrowseGitCommit.pm index 16c14928..c70b1d1b 100644 --- a/lib/PublicInbox/RepoBrowseGitCommit.pm +++ b/lib/PublicInbox/RepoBrowseGitCommit.pm @@ -55,21 +55,14 @@ sub git_commit_stream { $x .= "\n author $au\t$ad\ncommitter $cu\t$cd\n"; if (scalar(@p) == 1) { - $x .= ' parent '; my $p = $p[0]; - my $t = git_commit_title_html($git, $p); - $qs = $q->qs(id => $p); - $x .= qq(<a\nhref="${rel}commit$path$qs">$p</a> $t\n); + $x .= git_parent_line(' parent', $p, $q, $git, $rel, $path); } elsif (scalar(@p) > 1) { - foreach my $p (@p) { - $x .= ' merge '; - $qs = $q->qs(id => $p); - $x .= "<a\nhref=\"${rel}commit$path$qs\">$p</a> ("; - $qs = $q->qs(id => $p, id2 => $h); - $x .= "<a\nhref=\"${rel}diff$path$qs\">"; - $x .= "diff</a>) "; - $x .= git_commit_title_html($git, $p); - $x .= "\n"; + my @common = ($q, $git, $rel, $path); + my $p = shift @p; + $x .= git_parent_line(' parents', $p, @common); + foreach $p (@p) { + $x .= git_parent_line(' ', $p, @common); } } $fh->write($x .= "\n<b>$s</b>\n\n"); @@ -322,13 +315,6 @@ sub git_diff_cc_hunk { $rv .= " $at" . utf8_html($ctx); } -sub git_commit_title_html { - my ($git, $id) = @_; - my $t = git_commit_title($git, $id); - return '' unless defined $t; # BUG? - '[' . utf8_html($t) . ']'; -} - sub git_diffstat_rename { my ($rel, $h, $from, $to) = @_; my @from = split('/', $from); @@ -365,4 +351,12 @@ sub git_diff_mod { $pfx . (length($l) ? "<$t>$l</$t>" : $l); } +sub git_parent_line { + my ($pfx, $p, $q, $git, $rel, $path) = @_; + my $qs = $q->qs(id => $p); + my $t = git_commit_title($git, $p); + $t = defined $t ? utf8_html($t) : ''; + $pfx . " <a\nhref=\"${rel}commit$path$qs\">$p</a> ". $t . "\n"; +} + 1; |