Skip to content

Commit 416ee11

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

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env ruby
22

3+
require "tmpdir"
34
require File.dirname(__FILE__) + '/../test_helper'
45

56
# tests all the low level git communication
@@ -13,7 +14,16 @@ def setup
1314
set_file_paths
1415
@lib = Git.open(@wdir).lib
1516
end
16-
17+
18+
def test_fetch_unshallow
19+
Dir.mktmpdir("ruby-git-shallow") do |dir|
20+
git = Git.clone("file://#{@wdir}", "shallow", path: dir, depth: 1).lib
21+
assert_equal(1, git.log_commits.length)
22+
git.fetch("file://#{@wdir}", unshallow: true)
23+
assert_equal(71, git.log_commits.length)
24+
end
25+
end
26+
1727
def test_commit_data
1828
data = @lib.commit_data('1cc8667014381')
1929
assert_equal('scott Chacon <schacon@agadorsparticus.corp.reactrix.com> 1194561188 -0800', data['author'])

0 commit comments

Comments
 (0)