aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 5b5ab150a..8324de8f4 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -250,6 +250,10 @@ class GitDownloadStrategy <AbstractDownloadStrategy
@clone
end
+ def support_depth?
+ @url =~ %r(git://) or @url =~ %r(https://github.com/)
+ end
+
def fetch
raise "You must install Git:\n\n"+
" brew install git\n" \
@@ -268,7 +272,11 @@ class GitDownloadStrategy <AbstractDownloadStrategy
end
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
puts "Updating #{@clone}"
Dir.chdir(@clone) do