From 1c1950793cb3d508dcb7264c48f0bd600f39387e Mon Sep 17 00:00:00 2001 From: Alberto Pose Date: Sun, 18 May 2014 00:05:24 -0300 Subject: [PATCH] Adding branch parameter to repo.remote_push --- README.md | 5 ++++- src/repo.coffee | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dbe448c..9e06532 100644 --- a/README.md +++ b/README.md @@ -121,9 +121,12 @@ Remove a remote. ### `Repo#remote_fetch(name, callback)` `git fetch ` -### `Repo#remote_push(name, callback)` +### `Repo#remote_push(name, [branch, ]callback)` `git push ` +with branch parameter specified: +`git push ` + ### `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. diff --git a/src/repo.coffee b/src/repo.coffee index c97fbdf..16d8541 100644 --- a/src/repo.coffee +++ b/src/repo.coffee @@ -210,10 +210,17 @@ module.exports = class Repo # Public: `git push `. # # name - String name of the remote + # branch - (optional) Branch to push # callback - Receives `(err)`. # - remote_push: (name, callback) -> - @git "push", {}, name + remote_push: (name, branch, callback) -> + if !callback + callback = branch + args = name + else + args = [name, branch] + + @git "push", {}, args , (err, stdout, stderr) -> callback err