GitBranch.vala
authorAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 07:21:45 +0000 (15:21 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 07:21:45 +0000 (15:21 +0800)
GitBranch.vala

index 755968e..d877551 100644 (file)
@@ -8,10 +8,10 @@ public class GitBranch : Object
        public GitRepo repo;
        
        public bool active = false;
-       public string lastrev;
-       public string name;
-       public string remote:
-       public string remoterev;
+       public string lastrev = "";
+       public string name = "";
+       public string remote = "":
+       public string remoterev = "";
        
        public GitBranch(GitRepo repo)
        {
@@ -26,8 +26,16 @@ public class GitBranch : Object
                this.active = str[0] == '*';
                
                var bits = Regex.split_simple ("[ \t]+", str.substring(2).strip());
-
+               if (bits[1] == "->") { // it's an alias.. eg. remotes/origin/HEAD -> origin/master..
+                       return false;
+               }
                
+               this.lastrev = parts[1];
+               if (parts[0].has_prefix("remotes/")) {
+                       this.remote = parts[0];
+               } else {
+                       this.name = ""
+                       
        
        
        }
\ No newline at end of file