small fixes
authorpk910 <philipp@zoelle1.de>
Fri, 15 Feb 2013 01:55:12 +0000 (02:55 +0100)
committerpk910 <philipp@zoelle1.de>
Fri, 15 Feb 2013 01:57:51 +0000 (02:57 +0100)
htdocs/lib/GitCommand.class.php
htdocs/lib/graph.class.php
htdocs/pages/shortlog.class.php

index 609d0ad7d0575f06a1125b631cf1ce81889580ba..cb63050a46612cd0f1569ffd885d9fb8b2b6efdc 100644 (file)
@@ -133,7 +133,7 @@ class GitCommand {
        public static function get_hash($git_path, $ref) {
                $args = array("rev-parse", "--verify", "-q", $ref);
                $result = self::git_execute($args, $git_path);
-               if(prag_match("#([a-f0-9]{40})#i", $result, $match))
+               if(preg_match("#([a-f0-9]{40})#i", $result, $match))
                        return $match[1];
                return null;
        }
index 33c36b39e0d0d301c265455f9afc67a2a7860e95..6fdc069c8b2e1d92fd6c97acdb94c70388213aee 100644 (file)
@@ -42,13 +42,16 @@ class graph_data_generator {
                }
                unset($branch);
                if($existing)
-                       continue;
+                       return;
+               $name_arr = array();
+               if($name)
+                       $name_arr[] = $name;
                $this->data['branches'][count($this->data['branches'])] = array(
                        "id" => $this->brach_id++,
                        "uid" => $this->branch_uid++,
                        "active" => true,
                        "sticky" => true,
-                       "name" => array($name),
+                       "name" => $name_arr,
                        "next" => $first_id,
                        "pre_merge" => false
                );
@@ -147,7 +150,7 @@ class graph_data_generator {
                                $branch['active'] = false;
                                $commit['dot_type'] = self::DOT_TYPE_INIT;
                        }
-                       $branch['next'] = (array_key_exists('parent', $commit) ? $commit['parent'][0] : null);
+                       $branch['next'] = ((array_key_exists('parent', $commit) && count($commit['parent'])) ? $commit['parent'][0] : null);
                        $branch['pre_merge'] = false;
                        $this->data['ubranches'][$branch['uid']] = $this->data['branches'][$branch['id']-1];
                        
index 38c8db5e1139a1ff365f3e3fb6f11fa761a19dad..0bd823f15b837c66b0eccce332c61beee344ed75 100644 (file)
@@ -45,6 +45,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);