Skip to content

Commit

Permalink
Add force delete (notatestuser#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
clyde-labs authored and notatestuser committed Aug 25, 2017
1 parent ca8c35b commit b609d3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down
8 changes: 6 additions & 2 deletions src/repo.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b609d3d

Please sign in to comment.