Use --depth 1 more conservatively
This commit is contained in:
parent
b5c0f9ea03
commit
ebb6a98d67
@ -250,6 +250,10 @@ class GitDownloadStrategy <AbstractDownloadStrategy
|
|||||||
@clone
|
@clone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def support_depth?
|
||||||
|
@url =~ %r(git://) or @url =~ %r(https://github.com/)
|
||||||
|
end
|
||||||
|
|
||||||
def fetch
|
def fetch
|
||||||
raise "You must install Git:\n\n"+
|
raise "You must install Git:\n\n"+
|
||||||
" brew install git\n" \
|
" brew install git\n" \
|
||||||
@ -268,7 +272,11 @@ class GitDownloadStrategy <AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
unless @clone.exist?
|
unless @clone.exist?
|
||||||
safe_system 'git', 'clone', '--depth', '1', @url, @clone # indeed, leave it verbose
|
# Note: first-time checkouts are always done verbosely
|
||||||
|
git_args = %w(git clone)
|
||||||
|
git_args << "--depth" << "1" if support_depth?
|
||||||
|
git_args << @url << @clone
|
||||||
|
safe_system *git_args
|
||||||
else
|
else
|
||||||
puts "Updating #{@clone}"
|
puts "Updating #{@clone}"
|
||||||
Dir.chdir(@clone) do
|
Dir.chdir(@clone) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user