From 3710beda66913b279f8767dc212977cd963de3b8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 13 May 2014 16:17:58 +0100 Subject: [PATCH] download_strategy: fix Git repo updating. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Library/Homebrew/download_strategy.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 3d5f2ade1a..67b47e7a60 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