1
0
mirror of https://github.com/danog/gift.git synced 2024-12-02 09:17:55 +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:
Andrew Crites 2014-07-30 11:44:28 -04:00
parent 5836f32a21
commit 06bacc9217
2 changed files with 20 additions and 9 deletions

View File

@ -118,15 +118,18 @@ Equivalent to `git remote add <name> <url>`.
### `Repo#remote_remove(name, callback)` ### `Repo#remote_remove(name, callback)`
Remove a remote. Remove a remote.
### `Repo#remote_fetch(name, callback)` ### `Repo#remote_fetch(name, [options, ]callback)`
`git fetch <name>` `git fetch <name>`
### `Repo#remote_push(name, [branch, ]callback)` ### `Repo#remote_push(name, [branch, options, ]callback)`
`git push <name>` `git push <name>`
with branch parameter specified: with branch parameter specified:
`git push <name> <branch>` `git push <name> <branch>`
### `Repo#merge(name, [options, ]callback)`
`git merge <name>`
### `Repo#status(callback)` ### `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. 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.

View File

@ -202,8 +202,10 @@ module.exports = class Repo
# name - String name of the remote # name - String name of the remote
# callback - Receives `(err)`. # callback - Receives `(err)`.
# #
remote_fetch: (name, callback) -> remote_fetch: (name, options, callback) ->
@git "fetch", {}, name [options, callback] = [callback, options] if !callback
@git "fetch", options, name
, (err, stdout, stderr) -> , (err, stdout, stderr) ->
callback err callback err
@ -213,14 +215,18 @@ module.exports = class Repo
# branch - (optional) Branch to push # branch - (optional) Branch to push
# callback - Receives `(err)`. # callback - Receives `(err)`.
# #
remote_push: (name, branch, callback) -> remote_push: (name, branch, options, callback) ->
if !callback if !options && !callback
callback = branch callback = branch
args = name args = name
options = {}
else else
if !callback
callback = options
options = {}
args = [name, branch] args = [name, branch]
@git "push", {}, args @git "push", options, args
, (err, stdout, stderr) -> , (err, stdout, stderr) ->
callback err callback err
@ -229,8 +235,10 @@ module.exports = class Repo
# name - String name of the source # name - String name of the source
# callback - Receives `(err)`. # callback - Receives `(err)`.
# #
merge: (name, callback) -> merge: (name, options, callback) ->
@git "merge", {}, name [options, callback] = [callback, options] if !callback
@git "merge", options, name
, (err, stdout, stderr) -> , (err, stdout, stderr) ->
callback err callback err