aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/download_strategy.rb
diff options
context:
space:
mode:
authorMike McQuaid2014-05-13 16:17:58 +0100
committerMike McQuaid2014-05-13 16:23:06 +0100
commit73417db8b00982e49f11c87e99681fb4826a9184 (patch)
tree4610bac312121d2ccd535a41c5860e24632bba47 /Library/Homebrew/download_strategy.rb
parent0c912feebff9aa076e23ad2642b14a4ea8a4798d (diff)
downloadhomebrew-73417db8b00982e49f11c87e99681fb4826a9184.tar.bz2
download_strategy: fix Git repo updating.
Git repositories should always be updated when the ref is a branch. They should be also updated if no ref was specified or if the ref isn’t present. This stops the repo being updated if we’re building a specific revision and it is present. Additionally, this stops the update barfing on repositories where we’re using a revision and there is no upstream `master` branch. Closes #29218.
Diffstat (limited to 'Library/Homebrew/download_strategy.rb')
-rw-r--r--Library/Homebrew/download_strategy.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 3d5f2ade1..67b47e7a6 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -570,7 +570,9 @@ class GitDownloadStrategy < VCSDownloadStrategy
end
def update_repo
- unless @ref_type == :tag && has_ref?
+ # Branches always need updated. The has_ref? check will only work if a ref
+ # has been specified; if there isn't one we always want an update.
+ if @ref_type == :branch || !@ref || !has_ref?
quiet_safe_system 'git', 'fetch', 'origin'
end
end