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

Adding branch parameter to repo.remote_push

This commit is contained in:
Alberto Pose 2014-05-18 00:05:24 -03:00
parent 66865f063b
commit 1c1950793c
2 changed files with 13 additions and 3 deletions

View File

@ -121,9 +121,12 @@ Remove a remote.
### `Repo#remote_fetch(name, callback)` ### `Repo#remote_fetch(name, callback)`
`git fetch <name>` `git fetch <name>`
### `Repo#remote_push(name, callback)` ### `Repo#remote_push(name, [branch, ]callback)`
`git push <name>` `git push <name>`
with branch parameter specified:
`git push <name> <branch>`
### `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

@ -210,10 +210,17 @@ module.exports = class Repo
# Public: `git push <name>`. # Public: `git push <name>`.
# #
# name - String name of the remote # name - String name of the remote
# branch - (optional) Branch to push
# callback - Receives `(err)`. # callback - Receives `(err)`.
# #
remote_push: (name, callback) -> remote_push: (name, branch, callback) ->
@git "push", {}, name if !callback
callback = branch
args = name
else
args = [name, branch]
@git "push", {}, args
, (err, stdout, stderr) -> , (err, stdout, stderr) ->
callback err callback err