From b609d3d77b8964fba54404bebd8ac7bdcb83ac2a Mon Sep 17 00:00:00 2001 From: James McGill Date: Fri, 25 Aug 2017 08:44:31 -0400 Subject: [PATCH] Add force delete (#97) --- README.md | 2 +- src/repo.coffee | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ec8186..9f98626 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ Get a branch. Create a new branch with `name`, and call the callback when complete with an error, if one occurred. -### `Repo#delete_branch(delete, callback)` +### `Repo#delete_branch(delete, force, callback)` Delete the branch `name`, and call the callback with an error, if one occurred. ### `Repo#merge(name, [options, ]callback)` diff --git a/src/repo.coffee b/src/repo.coffee index d5b76f6..d4f9f4a 100644 --- a/src/repo.coffee +++ b/src/repo.coffee @@ -361,10 +361,14 @@ module.exports = class Repo # Public: Delete the branch with the given name. # # name - String name of the branch to delete. + # force - Force delete if true. # callback - Receives `(err)`. # - delete_branch: (name, callback) -> - @git "branch", {d: true}, name, (err, stdout, stderr) -> + delete_branch: (name, force, callback) -> + [force, callback] = [false, force] if !callback + opts = {d: true} + opts = {D: true} if force + @git "branch", opts, name, (err, stdout, stderr) -> return callback err # Public: Get the Branch with the given name.