Fix duplicate truncated shortlog entry
[gitphp.git] / include / display.git_summary.php
blob:a/include/display.git_summary.php -> blob:b/include/display.git_summary.php
<?php <?php
/* /*
* display.git_summary.php * display.git_summary.php
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Display - summary page * Component: Display - summary page
* *
* Copyright (C) 2008 Christopher Han <xiphux@gmail.com> * Copyright (C) 2008 Christopher Han <xiphux@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
   
include_once('util.date_str.php'); include_once('util.date_str.php');
include_once('gitutil.git_project_descr.php'); include_once('gitutil.git_project_descr.php');
include_once('gitutil.git_project_owner.php'); include_once('gitutil.git_project_owner.php');
include_once('gitutil.git_read_head.php'); include_once('gitutil.git_read_head.php');
include_once('gitutil.git_read_commit.php'); include_once('gitutil.git_read_commit.php');
include_once('gitutil.git_read_revlist.php'); include_once('gitutil.git_read_revlist.php');
include_once('gitutil.git_read_refs.php'); include_once('gitutil.git_read_refs.php');
include_once('gitutil.read_info_ref.php'); include_once('gitutil.read_info_ref.php');
   
function git_summary($projectroot,$project) function git_summary($projectroot,$project)
{ {
global $tpl; global $tpl;
$descr = git_project_descr($projectroot,$project); $descr = git_project_descr($projectroot,$project);
$head = git_read_head($projectroot . $project); $head = git_read_head($projectroot . $project);
$commit = git_read_commit($projectroot . $project, $head); $commit = git_read_commit($projectroot . $project, $head);
$commitdate = date_str($commit['committer_epoch'],$commit['committer_tz']); $commitdate = date_str($commit['committer_epoch'],$commit['committer_tz']);
$owner = git_project_owner($projectroot,$project); $owner = git_project_owner($projectroot,$project);
$refs = read_info_ref($projectroot . $project); $refs = read_info_ref($projectroot . $project);
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
$tpl->assign("head",$head); $tpl->assign("head",$head);
$tpl->display("project_nav.tpl"); $tpl->display("project_nav.tpl");
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("description",$descr); $tpl->assign("description",$descr);
$tpl->assign("owner",$owner); $tpl->assign("owner",$owner);
$tpl->assign("lastchange",$commitdate['rfc2822']); $tpl->assign("lastchange",$commitdate['rfc2822']);
$tpl->display("project_brief.tpl"); $tpl->display("project_brief.tpl");
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
$tpl->display("project_revlist_header.tpl"); $tpl->display("project_revlist_header.tpl");
$revlist = git_read_revlist($projectroot . $project, $head, 17); $revlist = git_read_revlist($projectroot . $project, $head, 17);
$alternate = FALSE; $alternate = FALSE;
foreach ($revlist as $i => $rev) { foreach ($revlist as $i => $rev) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$revco = git_read_commit($projectroot . $project, $rev); $revco = git_read_commit($projectroot . $project, $rev);
$authordate = date_str($revco['author_epoch']); $authordate = date_str($revco['author_epoch']);
if ($alternate) if ($alternate)
$tpl->assign("class","dark"); $tpl->assign("class","dark");
else else
$tpl->assign("class","light"); $tpl->assign("class","light");
$alternate = !$alternate; $alternate = !$alternate;
$tpl->assign("project",$project); $tpl->assign("project",$project);
if ($i < 16) { if ($i <= 16) {
$tpl->assign("commit",$rev); $tpl->assign("commit",$rev);
if (isset($refs[$rev])) if (isset($refs[$rev]))
$tpl->assign("commitref",$refs[$rev]); $tpl->assign("commitref",$refs[$rev]);
$tpl->assign("commitage",$revco['age_string']); $tpl->assign("commitage",$revco['age_string']);
$tpl->assign("commitauthor",$revco['author_name']); $tpl->assign("commitauthor",$revco['author_name']);
if (strlen($revco['title_short']) < strlen($revco['title'])) { if (strlen($revco['title_short']) < strlen($revco['title'])) {
$tpl->assign("title",$revco['title']); $tpl->assign("title",$revco['title']);
$tpl->assign("title_short",$revco['title_short']); $tpl->assign("title_short",$revco['title_short']);
} else } else
$tpl->assign("title_short",$revco['title']); $tpl->assign("title_short",$revco['title']);
} else { } else {
$tpl->assign("truncate",TRUE); $tpl->assign("truncate",TRUE);
} }
$tpl->display("project_revlist_item.tpl"); $tpl->display("project_revlist_item.tpl");
} }
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->display("project_revlist_footer.tpl"); $tpl->display("project_revlist_footer.tpl");
   
$taglist = git_read_refs($projectroot,$project,"refs/tags"); $taglist = git_read_refs($projectroot,$project,"refs/tags");
if (isset($taglist) && (count($taglist) > 0)) { if (isset($taglist) && (count($taglist) > 0)) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
$tpl->display("project_taglist_header.tpl"); $tpl->display("project_taglist_header.tpl");
$alternate = FALSE; $alternate = FALSE;
foreach ($taglist as $i => $tag) { foreach ($taglist as $i => $tag) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
if ($alternate) if ($alternate)
$tpl->assign("class","dark"); $tpl->assign("class","dark");
else else
$tpl->assign("class","light"); $tpl->assign("class","light");
$alternate = !$alternate; $alternate = !$alternate;
if ($i < 16) { if ($i < 16) {
$tpl->assign("tagage",$tag['age']); $tpl->assign("tagage",$tag['age']);
$tpl->assign("tagname",$tag['name']); $tpl->assign("tagname",$tag['name']);
$tpl->assign("tagid",$tag['id']); $tpl->assign("tagid",$tag['id']);
$tpl->assign("tagtype",$tag['type']); $tpl->assign("tagtype",$tag['type']);
$tpl->assign("refid",$tag['refid']); $tpl->assign("refid",$tag['refid']);
$tpl->assign("reftype",$tag['reftype']); $tpl->assign("reftype",$tag['reftype']);
if (isset($tag['comment'])) if (isset($tag['comment']))
$tpl->assign("comment",$tag['comment']); $tpl->assign("comment",$tag['comment']);
} else } else
$tpl->assign("truncate",TRUE); $tpl->assign("truncate",TRUE);
$tpl->display("project_taglist_item.tpl"); $tpl->display("project_taglist_item.tpl");
} }
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->display("project_taglist_footer.tpl"); $tpl->display("project_taglist_footer.tpl");
} }
   
$headlist = git_read_refs($projectroot,$project,"refs/heads"); $headlist = git_read_refs($projectroot,$project,"refs/heads");
if (isset($headlist) && (count($headlist) > 0)) { if (isset($headlist) && (count($headlist) > 0)) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
$tpl->display("project_headlist_header.tpl"); $tpl->display("project_headlist_header.tpl");
$alternate = FALSE; $alternate = FALSE;
foreach ($headlist as $i => $head) { foreach ($headlist as $i => $head) {
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->assign("project",$project); $tpl->assign("project",$project);
if ($alternate) if ($alternate)
$tpl->assign("class","dark"); $tpl->assign("class","dark");
else else
$tpl->assign("class","light"); $tpl->assign("class","light");
$alternate = !$alternate; $alternate = !$alternate;
if ($i < 16) { if ($i < 16) {
$tpl->assign("headage",$head['age']); $tpl->assign("headage",$head['age']);
$tpl->assign("headname",$head['name']); $tpl->assign("headname",$head['name']);
} else } else
$tpl->assign("truncate",TRUE); $tpl->assign("truncate",TRUE);
$tpl->display("project_headlist_item.tpl"); $tpl->display("project_headlist_item.tpl");
} }
   
$tpl->clear_all_assign(); $tpl->clear_all_assign();
$tpl->display("project_headlist_footer.tpl"); $tpl->display("project_headlist_footer.tpl");
} }
} }
   
?> ?>
   
comments