From f54a30a534525df48af6396a90a5729c8bc8618b Mon Sep 17 00:00:00 2001 From: Ben Burkert Date: Fri, 19 Aug 2011 11:08:46 -0700 Subject: [PATCH] Only clone with a depth when targeting HEAD or a tag. Closes Homebrew/homebrew#7101. Signed-off-by: Max Howell --- Library/Homebrew/download_strategy.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 32afea120d..b457fd9279 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -291,6 +291,14 @@ class GitDownloadStrategy < AbstractDownloadStrategy end def support_depth? + !commit_history_required? and depth_supported_host? + end + + def commit_history_required? + @spec == :sha + end + + def depth_supported_host? @url =~ %r(git://) or @url =~ %r(https://github.com/) end