diff options
| author | Adam Vandenberg | 2011-03-19 14:30:35 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2011-03-19 14:30:35 -0700 |
| commit | ebb6a98d67e4c9ba55bb921dae6afeb1fe3afa45 (patch) | |
| tree | 435ad1a419b7fdffa058218683c6b299dd7f7bf1 | |
| parent | b5c0f9ea03b3fd574529126797d292bf22e62149 (diff) | |
| download | brew-ebb6a98d67e4c9ba55bb921dae6afeb1fe3afa45.tar.bz2 | |
Use --depth 1 more conservatively
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 10 |
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 |
