Git.vala
[gitlive] / Git.vala
index 2b675ab..1124fda 100644 (file)
--- a/Git.vala
+++ b/Git.vala
@@ -20,8 +20,9 @@ void main()
        Ggit.init();
        
        var a = new GitLive.Repo("/home/alan/gitlive/gitlive");
+       a.loadBranches();
        a.fetchAll();
-       //a.branches();
+       //
        /*
        var a = new GitLive.Repo("/home/alan/git/test1-clone");
        //a.fetchAll();
@@ -68,9 +69,9 @@ namespace  GitLive {
                }
                
            Gee.ArrayList<Ggit.Branch>          branches = null;
-               public Gee.ArrayList<Ggit.Branch> loadBranches()
+               public void loadBranches()
                {
-                       this.branches new Gee.ArrayList<Ggit.Branch>();
+                       this.branches =  new Gee.ArrayList<Ggit.Branch>();
                        var r = this.repo.enumerate_branches(Ggit.BranchType.LOCAL);
                        
                        
@@ -87,16 +88,20 @@ namespace  GitLive {
                                
                        }
                        
-                       return ret;
+                       
                
                }
-               Ggit.Branch? getBranch(string remote_name)
+               Ggit.Branch? getBranch(string remote_name, string remote_branch_name)
                {
+                        GLib.debug("lookup %s:%s", remote_name, remote_branch_name);
                        foreach(var br in this.branches) {
-                               if (br.get_upstream().get_name() == remote_name) {
+                               GLib.debug("test:%s=%s", "refs/remotes/" +  br.get_upstream().get_shorthand() , remote_branch_name);
+                               if ("refs/remotes/" +  br.get_upstream().get_shorthand() == remote_branch_name) {
                                        return br;
                                }
+                               
                        }
+                       //GLib.debug("missing %s", remote_branch_name);                 
                        return null;
                
                }
@@ -123,7 +128,7 @@ namespace  GitLive {
                                
                                var heads = r.list();
                                foreach(var rh in heads) {
-                                       var br = this.getBranch(rh.get_name());
+                                       var br = this.getBranch(n, rh.get_shorthand());
                                
                                        GLib.debug("got heads: name=%s   rev=%s  localrev=%s",
                                                rh.get_name(),