diff options
| author | Jack Nagel | 2014-02-14 15:31:29 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-14 16:55:26 -0500 |
| commit | 32598fdf14b3c80aeca8cc7600454f6841e2552f (patch) | |
| tree | eaf485b9e2076f79c54f4c79b194ceb6c300c57d /Library | |
| parent | d894703150acaddeac00e1827c4c76475f1aecda (diff) | |
| download | homebrew-32598fdf14b3c80aeca8cc7600454f6841e2552f.tar.bz2 | |
GitDownloadStrategy: allow disabling of shallow clone
Closes #25751.
Closes #26730.
Diffstat (limited to 'Library')
| -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 |
