diff options
| author | Misty De Meo | 2015-06-30 20:29:48 -0700 |
|---|---|---|
| committer | Misty De Meo | 2015-06-30 20:52:39 -0700 |
| commit | f31e411f386f3366696cb192c28cb95b33249f3d (patch) | |
| tree | 3b082e819a4168946d7a3b484f2f18a778ef1980 /Library/Homebrew | |
| parent | 986a62ebe97666209f7726c57417a071202b0268 (diff) | |
| download | brew-f31e411f386f3366696cb192c28cb95b33249f3d.tar.bz2 | |
Git: unshallow shallow clones if necessary
Fixes Homebrew/homebrew#41225.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 10 |
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 |
