GitRepo.vala
[gitlive] / GitRepo.vala
index f0cf4e6..4ce43e5 100644 (file)
@@ -19,6 +19,7 @@ public class GitRepo : Object
     public string git_working_dir;
     public bool debug = false;
     public bool has_local_changes = false;
+    public string host = "";
     public string git_status;    
     public string git_diff;        
     public string ahead_or_behind = "";
@@ -171,6 +172,12 @@ public class GitRepo : Object
                if ( !cache.has_key(path) ) {
                        cache.set( path, this);
        }
+       
+       var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
+       var uri = new Soup.URI(r);      
+       this.host = uri.get_host();
+
+       
        this.loadBranches();
        this.loadActiveTicket();
        this.loadStatus();
@@ -186,9 +193,8 @@ public class GitRepo : Object
     public bool is_managed()
     {
        // is it a roojs origin?
-       var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
-       var uri = new Soup.URI(r);
-       if (uri.get_host() != "git.roojs.com") { // we can only push to this url. -- unless we have forced it to be managed.
+        
+       if (this.host != "git.roojs.com") { // we can only push to this url. -- unless we have forced it to be managed.
                return FileUtils.test(this.gitdir + "/.gitlive-managed" , FileTest.EXISTS);
        }
        // otherwise see if unmanaged is set to disable it..
@@ -220,7 +226,16 @@ public class GitRepo : Object
     
     public bool is_auto_branch ()
     {
-       return FileUtils.test(this.gitdir + "/.gitlive-enable-auto-branch" , FileTest.EXISTS);
+       if (this.name == "gitlog") {
+               return false;
+               }
+               // check remote...
+       if (this.is_managed()) {
+               return true;
+               }
+       return false;
+       
     }
     
     public void set_auto_branch(bool val)