mirror of
https://github.com/danog/gift.git
synced 2024-11-30 04:19:37 +01:00
Allow options to be specified for fetch, push, and merge operations
This minimally allows for force fetch and push
This commit is contained in:
parent
5836f32a21
commit
06bacc9217
@ -118,15 +118,18 @@ Equivalent to `git remote add <name> <url>`.
|
||||
### `Repo#remote_remove(name, callback)`
|
||||
Remove a remote.
|
||||
|
||||
### `Repo#remote_fetch(name, callback)`
|
||||
### `Repo#remote_fetch(name, [options, ]callback)`
|
||||
`git fetch <name>`
|
||||
|
||||
### `Repo#remote_push(name, [branch, ]callback)`
|
||||
### `Repo#remote_push(name, [branch, options, ]callback)`
|
||||
`git push <name>`
|
||||
|
||||
with branch parameter specified:
|
||||
`git push <name> <branch>`
|
||||
|
||||
### `Repo#merge(name, [options, ]callback)`
|
||||
`git merge <name>`
|
||||
|
||||
### `Repo#status(callback)`
|
||||
Uses `--porcelain` to parse repository status in a way that is agnostic of system language. The callback receives `(err, status)`. See below for a definition of what `status` is.
|
||||
|
||||
|
@ -202,8 +202,10 @@ module.exports = class Repo
|
||||
# name - String name of the remote
|
||||
# callback - Receives `(err)`.
|
||||
#
|
||||
remote_fetch: (name, callback) ->
|
||||
@git "fetch", {}, name
|
||||
remote_fetch: (name, options, callback) ->
|
||||
[options, callback] = [callback, options] if !callback
|
||||
|
||||
@git "fetch", options, name
|
||||
, (err, stdout, stderr) ->
|
||||
callback err
|
||||
|
||||
@ -213,14 +215,18 @@ module.exports = class Repo
|
||||
# branch - (optional) Branch to push
|
||||
# callback - Receives `(err)`.
|
||||
#
|
||||
remote_push: (name, branch, callback) ->
|
||||
if !callback
|
||||
remote_push: (name, branch, options, callback) ->
|
||||
if !options && !callback
|
||||
callback = branch
|
||||
args = name
|
||||
options = {}
|
||||
else
|
||||
if !callback
|
||||
callback = options
|
||||
options = {}
|
||||
args = [name, branch]
|
||||
|
||||
@git "push", {}, args
|
||||
@git "push", options, args
|
||||
, (err, stdout, stderr) ->
|
||||
callback err
|
||||
|
||||
@ -229,8 +235,10 @@ module.exports = class Repo
|
||||
# name - String name of the source
|
||||
# callback - Receives `(err)`.
|
||||
#
|
||||
merge: (name, callback) ->
|
||||
@git "merge", {}, name
|
||||
merge: (name, options, callback) ->
|
||||
[options, callback] = [callback, options] if !callback
|
||||
|
||||
@git "merge", options, name
|
||||
, (err, stdout, stderr) ->
|
||||
callback err
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user