From 9e059952994a427916c665ccc78dc5b03938e6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Tue, 27 May 2025 14:54:57 +0000 Subject: [PATCH] move `git fetch` before getting `origin_branch_name` --- Library/Homebrew/tap.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 1b487f52fa..395fce2b59 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -590,14 +590,15 @@ class Tap end return unless remote - current_upstream_head = T.must(git_repository.origin_branch_name) - return if requested_remote.blank? && git_repository.origin_has_branch?(current_upstream_head) - args = %w[fetch] args << "--quiet" if quiet args << "origin" args << "+refs/heads/*:refs/remotes/origin/*" safe_system "git", "-C", path, *args + + current_upstream_head = T.must(git_repository.origin_branch_name) + return if requested_remote.blank? && git_repository.origin_has_branch?(current_upstream_head) + git_repository.set_head_origin_auto new_upstream_head = T.must(git_repository.origin_branch_name)