Skip to content

Commit 656ea71

Browse files
committed
Adding branch option support for #clone.
1 parent 8e377fb commit 656ea71

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/git/lib.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def init(opts={})
4747
#
4848
# accepts options:
4949
# :remote:: name of remote (rather than 'origin')
50+
# :branch:: name of branch to track (rather than 'master')
5051
# :bare:: no working directory
5152
# :recursive:: after the clone is created, initialize all submodules within, using their default settings.
5253
# :depth:: the number of commits back to pull
@@ -58,6 +59,7 @@ def clone(repository, name, opts = {})
5859
clone_dir = opts[:path] ? File.join(@path, name) : name
5960

6061
arr_opts = []
62+
arr_opts << "-b" << opts[:branch] if opts[:branch]
6163
arr_opts << "--bare" if opts[:bare]
6264
arr_opts << "--recursive" if opts[:recursive]
6365
arr_opts << "-o" << opts[:remote] if opts[:remote]

0 commit comments

Comments
 (0)