diff options
| author | Jack Nagel | 2014-02-14 15:31:29 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-14 16:55:26 -0500 |
| commit | 7eec2d8b5a06ce40a079e2edf1d68ca1df75b70a (patch) | |
| tree | 70c39907253b51d54503c4ba3cdbc57e4be433ca | |
| parent | 5ce4c2a3f889c331fb12483c7bd4fee3b5addf1f (diff) | |
| download | brew-7eec2d8b5a06ce40a079e2edf1d68ca1df75b70a.tar.bz2 | |
GitDownloadStrategy: allow disabling of shallow clone
Closes Homebrew/homebrew#25751.
Closes Homebrew/homebrew#26730.
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index cf9e6113d..ca223ae6b 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -474,6 +474,11 @@ class GitDownloadStrategy < VCSDownloadStrategy %r{http://llvm\.org}, ] + def initialize name, resources + super + @shallow = resource.specs.fetch(:shallow) { true } + end + def cache_tag; "git" end def fetch @@ -513,6 +518,10 @@ class GitDownloadStrategy < VCSDownloadStrategy private + def shallow_clone? + @shallow && support_depth? + end + def support_depth? @ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |rx| rx === @url } end @@ -535,7 +544,7 @@ class GitDownloadStrategy < VCSDownloadStrategy def clone_args args = %w{clone} - args << '--depth' << '1' if support_depth? + args << '--depth' << '1' if shallow_clone? case @ref_type when :branch, :tag then args << '--branch' << @ref |
