Ggit.init();
var a = new GitLive.Repo("/home/alan/gitlive/gitlive");
- a.mergeMasterIntoHead();
+ //a.mergeMasterIntoHead();
//a.walkDiff();
- return;
- a.is_managed();
- a.is_autocommit();
+ //return;
+ //a.is_managed();
+ //a.is_autocommit();
a.loadLocalBranches();
a.loadRemoteHeads();
- a.fetchAll();
+ //a.fetchAll();
//
/*
var a = new GitLive.Repo("/home/alan/git/test1-clone");
//string[] spawn_env = Environ.get ();
// Process.spawn_sync ("/home/alan/git/test1-clone", spawn_args, spawn_env, SpawnFlags.SEARCH_PATH, null);
- a.pushAll();
+ //a.pushAll();
}
var br = r.get() as Ggit.Branch;
//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: name = %s upstream = %s oid = %s ",
- // br.get_name(), br.get_upstream().get_name(),
- // head.to_string());
+ 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.repo.get_config().get_string("user.name"),
this.repo.get_config().get_string("user.email")
);
- this.repo.create_commit("HEAD", sig, sig, null, "Test Merge", new_tree, parents);
-
+ this.repo.create_commit("HEAD", sig, sig, null, "Test Merge", new_tree, parents);
+
+
}
public void mergeMasterIntoHead()
var commits = new Ggit.AnnotatedCommit[] { ac };
this.repo.merge(commits, mo, co);
+
+ var cfg = this.repo.get_config().snapshot();
+
var sig = new Ggit.Signature.now(
- this.repo.get_config().get_string("user.name"),
- this.repo.get_config().get_string("user.email")
+ cfg.get_string("user.name"),
+ cfg.get_string("user.email")
);
var new_head = this.repo.get_head();
+ var oid = new_head.get_target();
+
+ var ix = this.repo.get_index();
+
+ ix.write();
+ var treeoid = ix.write_tree();
+
+ var new_tree = this.repo.lookup(treeoid,typeof (Ggit.Tree)) as Ggit.Tree;
- this.repo.create_commit("HEAD", sig, sig, null, "Test Merge", new_tree, parents);
+ var parent = new_head.lookup() as Ggit.Commit;
+ Ggit.Commit[] parents = new Ggit.Commit[] { parent };
+
+ this.repo.create_commit("refs/heads/" + this.head.get_name(), sig, sig, null, "Test Merge", new_tree, parents);
-
}
var r = this.repo.lookup_remote("origin");
r.connect(Ggit.Direction.FETCH, this.callbacks, null, null);
this.remote_heads = r.list();
-
+
+ foreach(var br in this.remote_heads) {
+ if (!br.get_name().has_prefix("refs/heads/")) {
+ continue;
+ }
+
+ GLib.debug("Remote: name=%s oid=%s local_oid=%s is_local=%s",
+ br.get_name().substring(11),
+ br.get_oid().to_string(),
+ br.get_local_oid().to_string(),
+ br.is_local() ? "Y" : "n"
+ );
+ }
+
}
-
-
+
Ggit.Branch? getBranch(string remote_name, string remote_branch_name)
{
br == null ? "?": this.repo.revparse(br.get_name() ).get_id().to_string()
);
*/
- var loc_oid = this.repo.revparse(br.get_name() ).get_id();
+ //var loc_oid = this.repo.revparse(br.get_name() ).get_id();
+
+ var loc_oid = br.get_target();
+
size_t ahead, behind;
this.repo.get_ahead_behind(
loc_oid,