Fix #5661 - MTrack - daily email large and no branch
[web.mtrack] / MTrack / SCM / Git / Repo.php
index 4c9d796..402e45a 100644 (file)
@@ -216,6 +216,9 @@ HOOK;
      * 
      * @param  string path (can be empty - eg. '')
      * @param  {number|date} limit  how many to fetch
+     *
+     *      -- prefered args:
+     *          
      * @param  {string} object = eg. rev|tag|branch  (use 'rev' here and ident=HASH to retrieve a speific revision
      * @param  {string} ident = 
      *
@@ -239,15 +242,26 @@ HOOK;
         } else {
             $args[] = "master";
         }
-       
-    
+     
         if ($limit !== null) {
             if (is_int($limit)) {
                 $args[] = "--max-count=$limit";
-            } else if (is_array($limit)) {
+            } else if (is_array($limit) && isset($limit[0]) && isset($limit[1])) {
                 
                 $args[] = "--skip={$limit[0]} --max-count={$limit[1]}";
-            } else {
+                
+                
+            /// oh what a horible hack.. - bad api design here.
+            } else if (is_array($limit) ) {
+                foreach($limit as $k=>$v) {
+                     
+                    $args[] = ($k == '-') ? $v : ('--'. $k .'='. $v);
+                    
+                }
+                 
+            } else if (strpos($limit,'..') !== false ) {
+                 $args[] = $limit;
+            } else {   
                 $args[] = "--since=$limit";
             }
         }
@@ -257,6 +271,7 @@ HOOK;
         $args[] = "--no-abbrev";
         $args[] = "--numstat";
         $args[] = "--date=rfc";
+        $args[] = "--source"; // show the branch..
         
         
         //echo '<PRE>';print_r($args);echo '</PRE>';
@@ -271,7 +286,7 @@ HOOK;
         $commit = null;
         while (true) {
           $line = fgets($fp);
-          if ($line === false) {
+          if ($line === false) { //end of file..
             if ($commit !== null) {
               $commits[] = $commit;
             }
@@ -373,7 +388,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);
     }