fixed shortlog entrycount & show refname / base commit on shortlog page
[phpgitweb.git] / htdocs / pages / shortlog.class.php
index 38c8db5e1139a1ff365f3e3fb6f11fa761a19dad..091e1d1140c2829766f7c2c85c4fa3044a9e2b8e 100644 (file)
@@ -26,6 +26,8 @@ class shortlog {
        
        public function generate_shortlog($project, $head, $max, $skip, $file = null, $pages = true, $next_page = 0) {
                $this->project = $project;
+               if($head && strtolower($head) == 'all')
+                       $head = null;
                $content = new ContentProvider('shortlog', 'shortlog');
                
                if(GitConfig::GITGRAPH_ENABLE) {
@@ -45,6 +47,10 @@ class shortlog {
                        $this->graph_data = new graph_data_generator();
                        if($head == null) {
                                //add all refs to the graph
+                               $rhash = GitCommand::get_hash($project['path'], "HEAD");
+                               if($rhash)
+                                       $this->graph_data->add_branch($rhash, null);
+                               
                                foreach($this->project['refs'] as $ref => $rhash) {
                                        if(preg_match('#^refs/heads/#i', $ref) && preg_match('/^[a-f0-9]*$/i', $rhash)) {
                                                $this->graph_data->add_branch($rhash, $ref);
@@ -64,7 +70,7 @@ class shortlog {
                $this->first_commit = $commits[0];
                foreach($commits as $commit) {
                        $commit_counter++;
-                       if($commit_counter < $skip)
+                       if($commit_counter <= $skip)
                                continue;
                        if($commit_counter > $max+$skip) {
                                $this->have_more = true;
@@ -148,8 +154,13 @@ class page_shortlog {
                $project['refs'] = $phpgitweb->get_project_loader()->getProjectRefs($project);
                $phpgitweb->append_header_nav("shortlog", null, true);
                $phpgitweb->append_title("shortlog");
+               CommitLoader::parse(true);
                
                $this->page = new ContentProvider('shortlog', 'main');
+               if(strtolower(CommitLoader::$commit_base_id) != 'all') {
+                       $this->page->set('refname', ' - '.CommitLoader::$commit_base_id);
+               } else
+                       $this->page->set('refname', '');
                
                //pages
                if(array_key_exists('pg', $_GET)) {
@@ -176,7 +187,7 @@ class page_shortlog {
                }
                
                $shortlog = new shortlog();
-               $this->page->set('shortlog', $shortlog->generate_shortlog($project, null, 100, $skip, null, true, $next_page));
+               $this->page->set('shortlog', $shortlog->generate_shortlog($project, CommitLoader::$commit_base_id, 100, $skip, null, true, $next_page));
                
                if($shortlog->get_have_more())
                        $subnav->set('next', new ContentProvider('shortlog', 'shortlog_subnav_next_link', array('page' => ($pg + 1))));