GitRepo.vala
authorAlan Knowles <alan@roojs.com>
Mon, 12 May 2014 02:16:22 +0000 (10:16 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 12 May 2014 02:16:22 +0000 (10:16 +0800)
GitRepo.vala

index 2e7c9e3..d7333d8 100644 (file)
@@ -32,6 +32,32 @@ public class GitRepo : Object
         return -1;
     
     }
+    
+    public static Array<GitRepo> list_cache = null;
+    
+    public static Array<GitRepo> list()
+    {
+        
+        if (Repo._list !== false) {
+            return Repo._list;
+        }
+        Repo._list  = [];
+        var dir = GLib.get_home_dir() + '/gitlive';
+        var ar = File.list(dir );
+        print(JSON.stringify(ar));
+        ar.forEach(function(f) {
+            if (File.exists(dir + '/' + f +'/.git')) {
+                Repo._list.push(new imports.Scm.Git.Repo.Repo(  {
+                    repopath : dir  +'/' + f,
+                    name : f
+                }))
+            }
+        });
+        
+        return Repo._list;
+          
+}
+    
  
    
     /**