GitMonitor.vala
authorAlan Knowles <alan@roojs.com>
Fri, 5 Sep 2014 03:55:10 +0000 (11:55 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 5 Sep 2014 03:55:10 +0000 (11:55 +0800)
GitMonitor.vala

index 09e2886..6a67288 100644 (file)
@@ -123,6 +123,24 @@ public class GitMonitorQueue : MonitorNamePathDir {
             return ret;
             
         }
+        
+        public static bool GitMonitorQueue.queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action)) {
+            for(var i =0; i < list.length; i++) {
+                var test = list.index(i);
+                if (list.index(i).gitpath != cmd_s.gitpath) {
+                    continue
+                }
+                if (list.index(i).vname != cmd_s.vname) {
+                    continue
+                }
+                if (list.index(i).action != action) {
+                    continue
+                }
+                return true;
+            }
+            return false;
+        }
+        
 }
 
 
@@ -695,7 +713,7 @@ public class GitMonitor : Monitor
         var cmd = new GitMonitorQueue(dest);
         cmd.action = "commit";
         cmd.message = "MOVED " + cmd_s.vname + " to " + cmd_d.vname;
-        if (GitMonitorQueue.queueHas(cmd_s, "add")) {
+        if (GitMonitorQueue.queueHas(this.queue, cmd_s, "add")) {
             cmd.message = cmd_d.vname;
         }