GitMonitor.vala
[gitlive] / GitMonitor.vala
index 981b389..9521391 100644 (file)
@@ -114,7 +114,15 @@ public class GitMonitorQueue : MonitorNamePathDir {
             }
             return string.joinv("\n",ret);
         }
-
+        public static string queueArrayToString(Array<GitMonitorQueue> list) {
+            var ret = "";
+            for(var i =0; i < list.length; i++) {
+                
+                ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
+            }
+            return ret;
+            
+        }
 }
 
 
@@ -382,11 +390,11 @@ public class GitMonitor : Monitor
                         break;
                 } 
             }
-            
+            print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
+            print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
             //repo.debug = 1;
             // these can fail... at present... as we wildcard stuff.
-            stdout.printf("ADD : %u files\n"  , add_files.length);
-            
+           
             // make sure added files do not get removed.. ?? 
             /*
             var remove_files_f = new Array<GitMonitorQueue>();
@@ -416,7 +424,9 @@ public class GitMonitor : Monitor
                 add_files_f.append_val(add_files.index(ii));
             };
             
-            
+            print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
+            print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
+           
             
             // make sure monitoring is paused so it does not recursively pick up
             // deletions
@@ -429,7 +439,7 @@ public class GitMonitor : Monitor
             
             // -- DO STUFF..            
             try {
-                repo.add(add_files);
+                repo.add(add_files_f);
             } catch(Error e) {
                 failure +=  e.message;
             }  
@@ -445,7 +455,7 @@ public class GitMonitor : Monitor
             try { 
                 success += repo.commit(
                     GitMonitorQueue.messageToString(messages),
-                    add_files  
+                    add_files_f
                 );
                 success += repo.push();
 
@@ -645,7 +655,7 @@ public class GitMonitor : Monitor
         this.lastAdd = new DateTime.now(new TimeZone.local()); 
         var cmd_s = new GitMonitorQueue(src);
 
-        var cmd_d = new GitMonitorQueue(src);
+        var cmd_d = new GitMonitorQueue(dest);
    
         
         if (cmd_d.gitpath != cmd_s.gitpath) {
@@ -669,13 +679,11 @@ public class GitMonitor : Monitor
 
             return;
         }
-        
+         
         cmd_s.action = "rm";
         this.queue.append_val(cmd_s);
 
-
-
-
+  
         cmd_d.action = "add";
         this.queue.append_val(cmd_d);