diff --git a/lib/git/lib.rb b/lib/git/lib.rb index fc390af5..bf45af79 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -747,6 +747,7 @@ def fetch(remote, opts) arr_opts << opts[:ref] if opts[:ref] arr_opts << '--tags' if opts[:t] || opts[:tags] arr_opts << '--prune' if opts[:p] || opts[:prune] + arr_opts << '--unshallow' if opts[:unshallow] command('fetch', arr_opts) end diff --git a/tests/units/test_lib.rb b/tests/units/test_lib.rb index ff5446f1..25e42022 100644 --- a/tests/units/test_lib.rb +++ b/tests/units/test_lib.rb @@ -13,7 +13,16 @@ def setup set_file_paths @lib = Git.open(@wdir).lib end - + + def test_fetch_unshallow + in_temp_dir do |dir| + git = Git.clone("file://#{@wdir}", "shallow", path: dir, depth: 1).lib + assert_equal(1, git.log_commits.length) + git.fetch("file://#{@wdir}", unshallow: true) + assert_equal(71, git.log_commits.length) + end + end + def test_commit_data data = @lib.commit_data('1cc8667014381') assert_equal('scott Chacon 1194561188 -0800', data['author'])