// valac -o /tmp/ggit Git.vala --pkg libgit2-glib-1.0 --pkg libsoup-2.4 --pkg gee-0.8 -g
-
-
+
void main()
{
);
Ggit.init();
-
-
- GLib.Timeout.add (10, () => {
+ var a = new GitLive.Repo("/home/alan/gitlive/web.coba");
+ a.fetchAll();
+ return;
+ /*
+ GLib.Timeout.add (1, () => {
GLib.debug("Meanwhile");
return true;
- }, GLib.Priority.DEFAULT);
+ }, GLib.Priority.HIGH);
var loop = new MainLoop();
-
- var a = new GitLive.Repo("/home/alan/gitlive/gitlive");
-
+
+ var a = new GitLive.Repo("/home/alan/gitlive/web.coba");
+ GLib.debug("Starting");
a.loadRemoteHeads.begin(true, (obj,res) => {
a.loadRemoteHeads.end(res);
- print("got results");
+ GLib.debug("got results");
a.loadLocalBranches();
loop.quit();
});
var r = this.repo.enumerate_branches(Ggit.BranchType.LOCAL);
while (r.next()) {
var br = r.get() as Ggit.Branch;
+ if (br == null) {
+ continue;
+ }
+ if (br.is_tag()) {
+ continue;
+ }
+
//var head = this.repo.revparse("refs/heads/" + br.get_name() ).get_id();
//var rhead = this.repo.revparse(br.get_upstream().get_name() ).get_id();
- GLib.debug("got branch: H=%s name = %s upstream = %s oid = %s ",
- br.is_head() ? "Y" : "n",
- br.get_name(),
- br.get_upstream().get_name().substring(20),
- br.get_target().to_string());
- this.branches.add(br);
- if (br.is_head()) {
- GLib.debug("HEAD= %s", br.get_name());
- this.head = br;
+ try {
+ GLib.debug("got branch: N=%s", br.get_name() );
+ GLib.debug("is_head %s", br.is_head() ? "Y" : "n");
+
+ GLib.debug("upstream = %s", br.get_upstream() == null ? "??" : br.get_upstream().get_name().substring(20));
+ GLib.debug("oid = %s",br.get_target().to_string());
+ this.branches.add(br);
+ if (br.is_head()) {
+ GLib.debug("HEAD= %s", br.get_name());
+ this.head = br;
+ }
+ } catch (Error e) {
+ GLib.debug("Skip branch");
}
-
}
}
var r = this.repo.lookup_remote("origin");
r.connect(Ggit.Direction.FETCH, this.callbacks, null, null);
+ yield;
this.remote_heads = r.list();
foreach(var br in this.remote_heads) {
}
GLib.debug("Remote: name=%s oid=%s local_oid=%s is_local=%s",
- br.get_name().substring(11),
+ br.get_name(),
br.get_oid().to_string(),
br.get_local_oid().to_string(),
br.is_local() ? "Y" : "n"
Idle.add((owned) callback);
return true;;
};
- new Thread<bool>("thread-example", run);
+ new Thread<bool>("loadRemoteHeads-" , run);
yield;