Uncommited changes synced
authorAlan Knowles <alan@roojs.com>
Tue, 27 Oct 2020 03:50:33 +0000 (11:50 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 27 Oct 2020 03:50:33 +0000 (11:50 +0800)
GitBranch.vala
GitRepo.vala

index 6a2dfa1..a2ec315 100644 (file)
@@ -79,17 +79,21 @@ 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 ");
+               }
                
                 
                var r = repo.repo.enumerate_branches(Ggit.BranchType.LOCAL);
index b9f4d37..fa5ce1a 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;
     }