@@ -57,6 +57,7 @@ def clone(repository, name, opts = {})
57
57
58
58
arr_opts = [ ]
59
59
arr_opts << "--bare" if opts [ :bare ]
60
+ arr_opts << "--mirror" if opts [ :mirror ]
60
61
arr_opts << "--recursive" if opts [ :recursive ]
61
62
arr_opts << "-o" << opts [ :remote ] if opts [ :remote ]
62
63
arr_opts << "--depth" << opts [ :depth ] . to_i if opts [ :depth ] && opts [ :depth ] . to_i > 0
@@ -68,7 +69,7 @@ def clone(repository, name, opts = {})
68
69
69
70
command ( 'clone' , arr_opts )
70
71
71
- opts [ :bare ] ? { :repository => clone_dir } : { :working_directory => clone_dir }
72
+ ( opts [ :bare ] or opts [ :mirror ] ) ? { :repository => clone_dir } : { :working_directory => clone_dir }
72
73
end
73
74
74
75
@@ -616,14 +617,19 @@ def fetch(remote, opts)
616
617
617
618
def push ( remote , branch = 'master' , opts = { } )
618
619
# Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
619
- opts = { :tags => opts } if [ true , false ] . include? ( opts )
620
+ opts = { :tags => opts } if [ true , false ] . include? ( opts )
620
621
621
622
arr_opts = [ ]
623
+ arr_opts << '--mirror' if opts [ :mirror ]
622
624
arr_opts << '--force' if opts [ :force ] || opts [ :f ]
623
625
arr_opts << remote
624
626
625
- command ( 'push' , arr_opts + [ branch ] )
626
- command ( 'push' , [ '--tags' ] + arr_opts ) if opts [ :tags ]
627
+ if opts [ :mirror ]
628
+ command ( 'push' , arr_opts )
629
+ else
630
+ command ( 'push' , arr_opts + [ branch ] )
631
+ command ( 'push' , [ '--tags' ] + arr_opts ) if opts [ :tags ]
632
+ end
627
633
end
628
634
629
635
def pull ( remote = 'origin' , branch = 'master' )
0 commit comments