php8 fixes
[web.mtrack] / MTrack / SCM / Git / Repo.php
index 72662a2..07b0e61 100644 (file)
@@ -9,6 +9,8 @@ class MTrack_SCM_Git_Repo extends MTrack_Repo
   public $gitdir = null;
 
   public $debug = false;
+  
+  var $project_id;
 
   public function getSCMMetaData() {
     return array(
@@ -242,23 +244,26 @@ HOOK;
         } else {
             $args[] = "master";
         }
-       
-    
+     
         if ($limit !== null) {
             if (is_int($limit)) {
                 $args[] = "--max-count=$limit";
-            } else if (is_array($limit) && isset($limit[0]) && isset($limit[2])) {
+            } else if (is_array($limit) && isset($limit[0]) && isset($limit[1])) {
                 
                 $args[] = "--skip={$limit[0]} --max-count={$limit[1]}";
+                
+                
+            /// oh what a horible hack.. - bad api design here.
             } else if (is_array($limit) ) {
-                foreach($line as $k=>$v) {
+                foreach($limit as $k=>$v) {
                      
-                    $args[] = ($k = '-') ? '' : ('--'. $k .'='. $v);
+                    $args[] = ($k == '-') ? $v : ('--'. $k .'='. $v);
                     
                 }
-                $args[] = "--skip={$limit[0]} --max-count={$limit[1]}";
-            } else {
-                    
+                 
+            } else if (strpos($limit,'..') !== false ) {
+                 $args[] = $limit;
+            } else {   
                 $args[] = "--since=$limit";
             }
         }
@@ -268,6 +273,7 @@ HOOK;
         $args[] = "--no-abbrev";
         $args[] = "--numstat";
         $args[] = "--date=rfc";
+        $args[] = "--source"; // show the branch..
         
         
         //echo '<PRE>';print_r($args);echo '</PRE>';
@@ -282,7 +288,7 @@ HOOK;
         $commit = null;
         while (true) {
           $line = fgets($fp);
-          if ($line === false) {
+          if ($line === false) { //end of file..
             if ($commit !== null) {
               $commits[] = $commit;
             }
@@ -384,7 +390,7 @@ HOOK;
               var_dump('git ' . join (' ' , $a));
             //  die("oops");
           }
-         // echo "git " . implode(" " , $a) . "\n";
+          //echo "git " . implode(" " , $a) . "\n";
           return MTrackSCM::run('git', 'read', $a);
     }