sync
authorAlan Knowles <alan@roojs.com>
Mon, 5 Nov 2018 05:52:27 +0000 (13:52 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 5 Nov 2018 05:52:27 +0000 (13:52 +0800)
GitRepo.vala

index d2f41a6..e68885b 100644 (file)
@@ -261,13 +261,12 @@ public class GitRepo : Object
  
                        try {
                                var oldbranch = this.currentBranch.name;
-                       string[] cmd = { "checkout",   "master"  };
-                       this.git( cmd );
-                       cmd = { "merge",   "--squash",  this.currentBranch.name };
+                               this.setActiveTicket(null, "master");
+                       string [] cmd = { "merge",   "--squash",  oldbranch };
                        this.git( cmd );
                         cmd = { "commit",   "--m",  commit_message };
                        this.git( cmd );
-                       this.loadBranches();
+                       this.loadBranches(); // updates lastrev..
                        
                        var notification = new Notify.Notification(
                                        "Merged branch %s to master".printf(oldbranch),
@@ -313,8 +312,7 @@ public class GitRepo : Object
        if (action == "EXIT") {
                        try {
                        var oldbranch  = this.currentBranch.name;
-                       string[] cmd = { "checkout",   "master"  };
-                       this.git( cmd );
+                               this.setActiveTicket(null, "master");
                        this.loadBranches();
                        var notification = new Notify.Notification(
                                        "Left branch %s".printf(oldbranch),
@@ -340,12 +338,22 @@ public class GitRepo : Object
     
     
     
-    public void setActiveTicket(RooTicket ticket, string branchname)
+    public void setActiveTicket(RooTicket? ticket, string branchname)
     {
        this.createBranchNamed(branchname);
-       FileUtils.set_contents(this.gitdir + "/.gitlive-active-ticket" , ticket.id);
+       if (ticket != null) {
+               FileUtils.set_contents(this.gitdir + "/.gitlive-active-ticket" , ticket.id);
+       } else {
+               if (FileUtils.test(this.gitdir + "/.gitlive-active-ticket",FileTest.EXISTS)) {
+                       FileUtils.remove(this.gitdir + "/.gitlive-active-ticket");
+                       }
+               }
+       
        this.activeTicket = ticket;
     }
+    
+    
+    
     public void loadTicket()
     {
        if (this.activeTicket != null) { // assumes merge will clear this...