GitMonitor.vala
[gitlive] / GitMonitor.vala
index 7be1ab5..4c7dfde 100644 (file)
@@ -20,18 +20,13 @@ public class GitMonitor : Monitor
 
  
 
-       public GitMonitor () {
-       
-       
+       public GitMonitor ()
+       {
        
                this.queue = new Array<GitMonitorQueue>();
                GitMonitor.gitmonitor = this;
-               
-
-               
                Timeout.add_full(Priority.LOW, 500, () => {
-                       
+
                        //GLib.debug("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
 
                        //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
@@ -54,7 +49,6 @@ public class GitMonitor : Monitor
                        return true; //
                });
                
-               
        }
 
        public new void pauseError(string failure) 
@@ -247,6 +241,7 @@ public class GitMonitor : Monitor
 
                this.paused = true;
 
+               var leave_queued = new Gee.ArrayList<GitMonitorQueue>();
                GLib.debug("GitMonitor.runQueue - creating repos");
                
                for(var i = 0; i < cmds.length; i++) {
@@ -254,11 +249,18 @@ public class GitMonitor : Monitor
                        var cmd = cmds.index(i);
                
                        var gitpath = cmd.gitpath; 
+                       
+                       var repo = GitRepo.get( gitpath );
+                       if ( !repo.is_wip_branch()) {
+                               leave_queued.add(cmd);
+                               continue;
+                       }
+                       
                        GLib.debug("GitMonitor.runQueue - finding %s", cmd.gitpath);
                
-                       var ix  = GitRepo.indexOf(repo_list,  cmd.gitpath);
+                       var ix  = GitRepo.indexOf(repo_list,   gitpath);
                        if (ix < 0) {
-                               repo_list.append_val(new GitRepo( gitpath ));
+                               repo_list.append_val( GitRepo.get( gitpath ));
                                ix = GitRepo.indexOf(repo_list,  cmd.gitpath);
                        }
                        GLib.debug("GitMonitor.runQueue - adding to repolist %d", ix);
@@ -329,6 +331,9 @@ public class GitMonitor : Monitor
                                                break;
                                } 
                        }
+                       
+                       repo.cmds.clear();
+                       
                        GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files));
                        GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files));