File tree 2 files changed +15
-5
lines changed 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -341,8 +341,11 @@ def fetch(remote = 'origin')
341
341
#
342
342
# @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')
343
343
#
344
- def push ( remote = 'origin' , branch = 'master' , tags = false )
345
- self . lib . push ( remote , branch , tags )
344
+ def push ( remote = 'origin' , branch = 'master' , opts = { } )
345
+ # Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
346
+ opts = { tags : opts } if [ true , false ] . include? ( opts )
347
+
348
+ self . lib . push ( remote , branch , opts )
346
349
end
347
350
348
351
# merges one or more branches into the current working branch
Original file line number Diff line number Diff line change @@ -571,9 +571,16 @@ def fetch(remote)
571
571
command ( 'fetch' , remote )
572
572
end
573
573
574
- def push ( remote , branch = 'master' , tags = false )
575
- command ( 'push' , [ remote , branch ] )
576
- command ( 'push' , [ '--tags' , remote ] ) if tags
574
+ def push ( remote , branch = 'master' , opts = { } )
575
+ # Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
576
+ opts = { tags : opts } if [ true , false ] . include? ( opts )
577
+
578
+ arr_opts = [ ]
579
+ arr_opts << '--f' if opts [ :force ] || opts [ :f ]
580
+ arr_opts << remote
581
+
582
+ command ( 'push' , arr_opts + [ branch ] )
583
+ command ( 'push' , [ '--tags' ] + arr_opts ) if opts [ :tags ]
577
584
end
578
585
579
586
def pull ( remote = 'origin' , branch = 'master' )
You can’t perform that action at this time.
0 commit comments