From 34f547b56aa0180e0bc9bf63d4e38430964d8b03 Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Mon, 20 Aug 2012 12:10:18 -0700 Subject: [PATCH] branch deleting now works --- src/git.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/git.js b/src/git.js index faf4ae1d..76181ec2 100644 --- a/src/git.js +++ b/src/git.js @@ -235,18 +235,17 @@ GitEngine.prototype._deleteBranch = function(name) { // trying to delete, lets check our refs var target = this._resolveId(name); if (target.get('type') !== 'branch') { - throw new Error("You can't delete things that arent branches with -d"); + throw new Error("You can't delete things that arent branches with branch command"); } - if (target.get('id') == 'master') { throw new Error("You can't delete the master branch!"); } - if (this.HEAD.get('target') === target) { - // we need to change HEAD to a commit then + throw new Error("Cannot delete the branch you are currently on"); } - this.refs[id].delete(); + var id = target.get('id'); + target.delete(); delete this.refs[id]; };