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 Homebrew/homebrew#29218.
This commit is contained in:
parent
a78b906389
commit
3710beda66
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user