return;
}
+$baseurl = 'login/commits';
$pagesize = intval(@$Page->place['n'] ?: @$_GET['n']) ?: 20;
-$gitcmd = "git log -n $pagesize --pretty='%at\t%an\t%s'";
+$gitcmd = "git log -n $pagesize --pretty='%h\t%at\t%an\t%s'";
if ( $offset = intval(@$_GET['start']) ) {
$gitcmd .= " --skip=$offset";
$lines = 0;
print "<ul>\n";
while ( $line = fgets($log) ) {
- list ($atime, $author, $message) = explode("\t", $line, 3);
+ list ($id, $atime, $author, $message) = explode("\t", $line, 4);
list ($author) = explode(' ', $author); # first name only
- printf('<li>%s <small class="date">%s • %s</small></li>'."\n",
- htmlspecialchars($message),
+ $html = htmlspecialchars(rtrim($message));
+ $html .= sprintf(' <small class="date">%s • %s</small>',
htmlspecialchars($author), strftime('%F %H:%M', $atime)
);
+ $html = sprintf('<a href="%s">%s</a>',
+ "/$baseurl/$id", $html
+ );
+ print "<li>$html</li>\n";
$lines++;
}
print "</ul>\n\n";
$limit = $offset + $lines + 1; # assume one more
print $Page->widget('nav', [
'start' => $offset, 'n' => $pagesize, 'total' => $limit,
- 'link' => $Page->link != 'login/commits' ? 'login/commits' : '',
+ 'link' => $Page->link == $baseurl ? NULL : $baseurl,
]);
}