revert code that did not affect memory
[gitlive] / GitBranch.vala
index 6a2dfa1..1f309f4 100644 (file)
@@ -79,19 +79,26 @@ public class GitBranch : Object
                
                var rem = repo.repo.lookup_remote("origin");
                var cb = new GitCallbacks(repo);
-               rem.connect(Ggit.Direction.FETCH, cb, null, null);
-               var remote_heads = rem.list();
-               foreach(var rh in remote_heads) {
-                       var rn = rh.get_name();
-                       if (!rn.has_prefix("refs/heads/")) {
-                               continue;
-                       }
-                       remotes.set(rn.substring(11), rh.get_oid());
-                       remotes_used.set(rn.substring(11), false);
+               try {
+                       rem.connect(Ggit.Direction.FETCH, cb, null, null);
+                       var remote_heads = rem.list();
+                       foreach(var rh in remote_heads) {
+                               var rn = rh.get_name();
+                               if (!rn.has_prefix("refs/heads/")) {
+                                       continue;
+                               }
+                               remotes.set(rn.substring(11), rh.get_oid());
+                               remotes_used.set(rn.substring(11), false);
 
-         } 
+                   } 
+                  
+                   
+               } catch (Error e) {
+                       GLib.debug("Failed to fetch remotes continuing on ");
+               }
+          rem.disconnect();
+               
                
-                
                var r = repo.repo.enumerate_branches(Ggit.BranchType.LOCAL);
                while (r.next()) {
                
@@ -106,13 +113,17 @@ public class GitBranch : Object
                        br.active = gbr.is_head();
                        br.name = gbr.get_name();
                        br.lastrev = gbr.get_target().to_string();
-                       string rname ;
+                       string rname ="";
+                       /*
+                       
+                       THIS IS DISABLED, and get_upstream has a major memor leak.
                        try {
                                rname = gbr.get_upstream() != null ? gbr.get_upstream().get_name() : "";
                        } catch(Error e) {
                                GLib.debug("Skip branch = got error");
                                continue;
                        }
+                       */
                        repo.branches.set(gbr.get_name(), br);                  
                        if (rname.has_prefix("refs/remotes/origin/")) {
                                rname = rname.substring(20);