Skip to content

Commit a86eb24

Browse files
committed
Add support for unshallow
Signed-off-by: Stephen Paul Weber <singpolyma@singpolyma.net>
1 parent 6d5bacd commit a86eb24

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/git/lib.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ def fetch(remote, opts)
747747
arr_opts << opts[:ref] if opts[:ref]
748748
arr_opts << '--tags' if opts[:t] || opts[:tags]
749749
arr_opts << '--prune' if opts[:p] || opts[:prune]
750+
arr_opts << '--unshallow' if opts[:unshallow]
750751

751752
command('fetch', arr_opts)
752753
end

tests/units/test_lib.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ def setup
1313
set_file_paths
1414
@lib = Git.open(@wdir).lib
1515
end
16-
16+
17+
def test_fetch_unshallow
18+
in_temp_dir do |dir|
19+
git = Git.clone("file://#{@wdir}", "shallow", path: dir, depth: 1).lib
20+
assert_equal(1, git.log_commits.length)
21+
git.fetch("file://#{@wdir}", unshallow: true)
22+
assert_equal(71, git.log_commits.length)
23+
end
24+
end
25+
1726
def test_commit_data
1827
data = @lib.commit_data('1cc8667014381')
1928
assert_equal('scott Chacon <schacon@agadorsparticus.corp.reactrix.com> 1194561188 -0800', data['author'])

0 commit comments

Comments
 (0)