1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00

Add force delete (#97)

This commit is contained in:
James McGill 2017-08-25 08:44:31 -04:00 committed by Luke Plaster
parent ca8c35b5e9
commit b609d3d77b
2 changed files with 7 additions and 3 deletions

View File

@ -165,7 +165,7 @@ Get a branch.
Create a new branch with `name`, and call the callback when complete Create a new branch with `name`, and call the callback when complete
with an error, if one occurred. 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. Delete the branch `name`, and call the callback with an error, if one occurred.
### `Repo#merge(name, [options, ]callback)` ### `Repo#merge(name, [options, ]callback)`

View File

@ -361,10 +361,14 @@ module.exports = class Repo
# Public: Delete the branch with the given name. # Public: Delete the branch with the given name.
# #
# name - String name of the branch to delete. # name - String name of the branch to delete.
# force - Force delete if true.
# callback - Receives `(err)`. # callback - Receives `(err)`.
# #
delete_branch: (name, callback) -> delete_branch: (name, force, callback) ->
@git "branch", {d: true}, name, (err, stdout, stderr) -> [force, callback] = [false, force] if !callback
opts = {d: true}
opts = {D: true} if force
@git "branch", opts, name, (err, stdout, stderr) ->
return callback err return callback err
# Public: Get the Branch with the given name. # Public: Get the Branch with the given name.