X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=htdocs%2Fpages%2Fcommit.class.php;h=57f20e5d8b18def5b68871a9bd58e9595cc67956;hb=b400fe63ce2c5db919a479101e8b261f479e8d0b;hp=3c10b4486d1798bb7675eaac08b9de1863202158;hpb=3225d787391540a52b39a34ca809a71d443b49f0;p=phpgitweb.git diff --git a/htdocs/pages/commit.class.php b/htdocs/pages/commit.class.php index 3c10b44..57f20e5 100644 --- a/htdocs/pages/commit.class.php +++ b/htdocs/pages/commit.class.php @@ -16,24 +16,33 @@ * along with this program. If not, see . */ -require_once('pages/shortlog.class.php'); - class difftree { + private $difftree_data = null; + + public function push_difftree_data($data) { + $this->difftree_data = $data; + } public function generate_difftree($project, $commit, $patch_link) { $difftree = new ContentProvider('commit', 'difftree'); - $tree = GitCommand::get_commit_changes($project['path'], $commit['id'], $commit['parent']); + if($this->difftree_data) + $tree = $this->difftree_data; + else + $tree = GitCommand::get_commit_changes($project['path'], $commit['id'], $commit['parent']); $entry_count = 0; if(count($commit['parent']) > 1) $difftree->set('class', ' combined'); else $difftree->set('class', ''); + $difftree->set('tree_count', ''); foreach($tree as $entry) { $entry_count++; $difftree->append('tree', $this->tree_entry($entry_count, (($entry_count % 2) ? 'dark' : 'light'), $commit, $entry, $patch_link)); } - if(count($tree) == 0) + if($entry_count == 0) $difftree->set('tree', ''); + else if($entry_count > 10) + $difftree->set('tree_count', new ContentProvider('commit', 'tree_count', array('count' => $entry_count))); return $difftree; } @@ -138,7 +147,7 @@ class difftree { } } else $tree->set('specials', ''); - if($entry['from_id'] != $entry['to_id']) + if(!$patch_link && $entry['from_id'] != $entry['to_id']) $tree->append('links', new ContentProvider('commit', 'tree_changed_links_diff', $link_placeholders)); $tree->append('links', new ContentProvider('commit', 'tree_changed_links', $link_placeholders)); break; @@ -171,7 +180,6 @@ class difftree { class page_commit { private $page, $phpgitweb; - private $commitid; public function main($phpgitweb, $project) { $this->phpgitweb = $phpgitweb; @@ -180,19 +188,14 @@ class page_commit { $project['refs'] = $phpgitweb->get_project_loader()->getProjectRefs($project); $phpgitweb->append_header_nav("commit", null, true); $phpgitweb->append_title("commit"); + CommitLoader::parse(); $commit_loader = new CommitLoader($project); - - if(array_key_exists('h', $_GET)) - $commitid = $_GET['h']; - else - $commitid = "HEAD"; - - $commit = $commit_loader->load($commitid); + $commit = $commit_loader->load(); if(!$commit) return new ContentProvider('main', 'err404_object'); - ContentProvider::overall_set('project_head', $commit['id']); + ContentProvider::overall_set('commit_id', $commit['id']); $this->page = new ContentProvider('commit', 'main'); @@ -215,7 +218,7 @@ class page_commit { else $this->page->set('committer_local_date', gmdate('H:i', $committer_local_time)); $this->page->set('committer_timezone', $commit['committer_timezone']); - $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 50, 5))); + $this->page->set('message', htmlentities(Tools::chop_text($commit['text'], 80, 5))); $this->page->set('full_message', htmlentities($commit['text'])); $this->page->set('tree_hash', $commit['tree']); foreach($commit['parent'] as $parent) {