X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=GitBranch.vala;h=20e36fdebee5222ecbdc46ca0346a09fc0bfb382;hb=c8bc028311655fb453141768779b772a063f4b2c;hp=58da00f2e858b4f5bda357889c68c5b8cc1bff87;hpb=9adf374263e53c2dd89f2b3d583374c7b99fe68a;p=gitlive diff --git a/GitBranch.vala b/GitBranch.vala index 58da00f2..20e36fde 100644 --- a/GitBranch.vala +++ b/GitBranch.vala @@ -92,11 +92,18 @@ public class GitBranch : Object while (r.next()) { var br = new GitBranch(repo); var gbr = r.get() as Ggit.Branch; - repo.branches.set(gbr.get_name(), br); + br.active = gbr.is_head(); br.name = gbr.get_name(); br.lastrev = gbr.get_target().to_string(); - var rname = gbr.get_upstream() != null ? gbr.get_upstream().get_name() : ""; + string rname ; + 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); if (remotes.has_key(rname)) { @@ -119,6 +126,10 @@ public class GitBranch : Object // age? // behind or infront.. } + if (br.active) { + GLib.debug("repo: %s currentBranch = %s", repo.name, br.name); + repo.currentBranch = br; + } } @@ -140,6 +151,9 @@ public class GitBranch : Object repo.branches.set(rn, br); } + if (repo.currentBranch == null) { + GLib.error("could not find active Branch for %s", repo.name); + }