From 8fa1f9e6e0a04ee2321942d2e920580fcdbfa8b6 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 15 Mar 2019 16:14:19 +0800 Subject: [PATCH] sync --- Git.vala | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Git.vala b/Git.vala index 566ad557..8141f8e5 100644 --- a/Git.vala +++ b/Git.vala @@ -206,6 +206,31 @@ namespace GitLive { var anc_commit = this.repo.lookup_commit(anc_oid); var anc_tree = anc_commit.get_tree(); + var mo = new Ggit.MergeOptions(); + var co = new Ggit.CheckoutOptions(); + var commits = new Ggit.Commit[] { master_commit }; + + this.repo.merge(commits, mo, co); + /* + if (ix.has_conflicts()) { + GLib.debug("merge has conflicts"); + return; + } + + var cfg = this.repo.get_config().snapshot(); + var sig = new Ggit.Signature.now( + cfg.get_string("user.name"), + cfg.get_string("user.email") + ); + + var parents = new Ggit.OId[] { anc_commit.get_id() }; + + var treeoid = ix.write_tree_to(this.repo); + + this.repo.create_commit_from_ids("HEAD", + sig, sig, null, "Test Merge", treeoid, parents); + + /* var master_tree = master_commit.get_tree(); var head_tree = head_commit.get_tree(); var mo = new Ggit.MergeOptions(); @@ -213,10 +238,6 @@ namespace GitLive { var ix = this.repo.merge_trees(anc_tree, master_tree, head_tree, mo); // might be conflicts.. - if (ix.has_conflicts()) { - GLib.debug("merge has conflicts"); - return; - } this.repo.checkout_index(ix, new Ggit.CheckoutOptions()); var treeoid = ix.write_tree(); @@ -226,12 +247,9 @@ namespace GitLive { var new_tree = this.repo.lookup(treeoid,typeof (Ggit.Tree)) as Ggit.Tree; - var sig = new Ggit.Signature.now( - 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); - + */ } -- 2.39.2