sync
authorAlan Knowles <alan@roojs.com>
Fri, 15 Mar 2019 08:14:19 +0000 (16:14 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 15 Mar 2019 08:14:19 +0000 (16:14 +0800)
Git.vala

index 566ad55..8141f8e 100644 (file)
--- 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);
-       
+               */
                
                }