MTrack/SCM/Git/Repo.php
authorAlan Knowles <alan@roojs.com>
Sat, 3 Nov 2012 04:59:48 +0000 (12:59 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 3 Nov 2012 04:59:48 +0000 (12:59 +0800)
MTrack/SCM/Git/Repo.php

index 196d985..e9760ba 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 = 
      *
@@ -244,10 +247,16 @@ HOOK;
         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[2])) {
                 
+                $args[] = "--skip={$limit[0]} --max-count={$limit[1]}";
+            } else if (is_array($limit) ) {
+                foreach($line as $k=>$v) {
+                    $args[] = ($k = '-' ? '' : ('--'. $k .'='. $v;
+                }
                 $args[] = "--skip={$limit[0]} --max-count={$limit[1]}";
             } else {
+                    
                 $args[] = "--since=$limit";
             }
         }