Skip to content

Commit 5ce8412

Browse files
committed
Add --filter to Git.clone for partial clones
Signed-off-by: Andy Meneely <andy.meneely@gmail.com>
1 parent cfcf40f commit 5ce8412

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
@@ -84,6 +84,7 @@ def init(opts={})
8484
# :bare:: no working directory
8585
# :branch:: name of branch to track (rather than 'master')
8686
# :depth:: the number of commits back to pull
87+
# :filter:: specify partial clone
8788
# :origin:: name of remote (same as remote)
8889
# :path:: directory where the repo will be cloned
8990
# :remote:: name of remote (rather than 'origin')
@@ -101,6 +102,7 @@ def clone(repository_url, directory, opts = {})
101102
arr_opts << '--bare' if opts[:bare]
102103
arr_opts << '--branch' << opts[:branch] if opts[:branch]
103104
arr_opts << '--depth' << opts[:depth].to_i if opts[:depth] && opts[:depth].to_i > 0
105+
arr_opts << "--filter=#{opts[:filter]}" if opts[:filter]
104106
Array(opts[:config]).each { |c| arr_opts << '--config' << c }
105107
arr_opts << '--origin' << opts[:remote] || opts[:origin] if opts[:remote] || opts[:origin]
106108
arr_opts << '--recursive' if opts[:recursive]

0 commit comments

Comments
 (0)