revert code that did not affect memory
[gitlive] / GitRepo.vala
index 9cb29f6..a4d1bfd 100644 (file)
@@ -29,10 +29,12 @@ public class GitRepo : Object
     public GitBranch  _currentBranch;
     public GitBranch  getCurrentBranch() {
        if (this._currentBranch == null) {
+               Posix.usleep(100); // try and slow down branch loading          
                this.loadBranches();
+
        }
        if (this._currentBranch == null) {      
-               GLib.error("could not work out current branch?");
+               GLib.error("could not work out current branch? : %s ",this.git_working_dir );
                }
                return this._currentBranch;
     }
@@ -674,7 +676,7 @@ public class GitRepo : Object
                                }
                        }
                        if (end == "") {
-                               var last = lines[lines.length-1];
+                               var last = lines.length > 0 ? lines[lines.length-1] : "";
                                end = last.split(" ")[1];                               
                        }
 
@@ -1012,6 +1014,7 @@ public class GitRepo : Object
                                var options = new Ggit.FetchOptions();
                                options.set_remote_callbacks( new GitCallbacks(this));
                                r.download(far, options);
+                               r.disconnect();
                        }
                        this.loadStatus();
                         
@@ -1135,6 +1138,7 @@ public class GitRepo : Object
                var cb = new GitCallbacks(this);
                r.connect(Ggit.Direction.FETCH, cb, null, null);
                this.remote_heads = r.list();
+               r.disconnect();
        
        }