aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2015-06-30 20:29:48 -0700
committerMisty De Meo2015-06-30 20:52:39 -0700
commitf31e411f386f3366696cb192c28cb95b33249f3d (patch)
tree3b082e819a4168946d7a3b484f2f18a778ef1980 /Library
parent986a62ebe97666209f7726c57417a071202b0268 (diff)
downloadbrew-f31e411f386f3366696cb192c28cb95b33249f3d.tar.bz2
Git: unshallow shallow clones if necessary
Fixes Homebrew/homebrew#41225.
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 597ab1ad9..6ee032a71 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -582,6 +582,10 @@ class GitDownloadStrategy < VCSDownloadStrategy
@shallow && support_depth?
end
+ def is_shallow_clone?
+ git_dir.join("shallow").exist?
+ end
+
def support_depth?
@ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |rx| rx === @url }
end
@@ -632,7 +636,11 @@ class GitDownloadStrategy < VCSDownloadStrategy
def update_repo
if @ref_type == :branch || !has_ref?
- quiet_safe_system 'git', 'fetch', 'origin'
+ if !shallow_clone? && is_shallow_clone?
+ quiet_safe_system 'git', 'fetch', 'origin', '--unshallow'
+ else
+ quiet_safe_system 'git', 'fetch', 'origin'
+ end
end
end