aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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