Skip to content

Commit a8b5bd7

Browse files
committed
Allow a block to receive push output
1 parent 41d9e3e commit a8b5bd7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/git/base.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ def fetch(remote = 'origin', opts={})
341341
#
342342
# @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')
343343
#
344-
def push(remote = 'origin', branch = 'master', opts = {})
344+
def push(remote = 'origin', branch = 'master', opts = {}, &block)
345345
# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
346346
opts = {:tags => opts} if [true, false].include?(opts)
347347

348-
self.lib.push(remote, branch, opts)
348+
self.lib.push(remote, branch, opts, &block)
349349
end
350350

351351
# merges one or more branches into the current working branch

lib/git/lib.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -614,16 +614,16 @@ def fetch(remote, opts)
614614
command('fetch', arr_opts)
615615
end
616616

617-
def push(remote, branch = 'master', opts = {})
617+
def push(remote, branch = 'master', opts = {}, &block)
618618
# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
619619
opts = {:tags => opts} if [true, false].include?(opts)
620620

621621
arr_opts = []
622622
arr_opts << '--force' if opts[:force] || opts[:f]
623623
arr_opts << remote
624624

625-
command('push', arr_opts + [branch])
626-
command('push', ['--tags'] + arr_opts) if opts[:tags]
625+
command('push', arr_opts + [branch], &block)
626+
command('push', ['--tags'] + arr_opts, &block) if opts[:tags]
627627
end
628628

629629
def pull(remote='origin', branch='master')

0 commit comments

Comments
 (0)