From 50a43cf6780cc5380bb00d192296d91ebb3cddc9 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 25 May 2018 22:47:31 +0200 Subject: [PATCH 1/3] Reset `repo_var` in `clear_cache`. --- Library/Homebrew/compat/tap.rb | 3 +-- Library/Homebrew/tap.rb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb index 1fd53058a5..df720e35eb 100644 --- a/Library/Homebrew/compat/tap.rb +++ b/Library/Homebrew/compat/tap.rb @@ -15,10 +15,9 @@ class Tap old_path = path old_remote = path.git_origin + clear_cache super(new_user, new_repo) - @repo_var = nil - new_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}" new_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}" diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index eec9c175ab..fa167c5a89 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -84,6 +84,7 @@ class Tap # clear internal cache def clear_cache @remote = nil + @repo_var = nil @formula_dir = nil @cask_dir = nil @formula_files = nil From d1fb1d2abc9eeffde4f2318f09d72978dd68949b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 25 May 2018 22:47:41 +0200 Subject: [PATCH 2/3] Use simpler check. --- Library/Homebrew/cmd/search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index faf9557e76..a9afe5ad7d 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -122,7 +122,7 @@ module Homebrew matches.map do |match| filename = File.basename(match["path"], ".rb") tap = Tap.fetch(match["repository"]["full_name"]) - next if tap.installed? && !(tap.user == "Homebrew" && tap.repo.start_with?("cask")) + next if tap.installed? && !tap.name.start_with?("homebrew/cask") "#{tap.name}/#{filename}" end.compact end From df2a40d20794ac2cb377479451acaf89ca2f6d17 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 25 May 2018 22:54:34 +0200 Subject: [PATCH 3/3] Use `remote` instead of `path.git_origin`. --- Library/Homebrew/compat/tap.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb index df720e35eb..13c667f286 100644 --- a/Library/Homebrew/compat/tap.rb +++ b/Library/Homebrew/compat/tap.rb @@ -13,7 +13,7 @@ class Tap old_name = name old_path = path - old_remote = path.git_origin + old_remote = remote clear_cache super(new_user, new_repo) @@ -24,8 +24,6 @@ class Tap ENV[new_initial_revision_var] ||= ENV[old_initial_revision_var] ENV[new_current_revision_var] ||= ENV[old_current_revision_var] - return unless old_path.git? - new_name = name new_path = path new_remote = default_remote @@ -36,6 +34,8 @@ class Tap path.dirname.mkpath FileUtils.mv old_path, new_path + return unless old_path.git? + puts "Changing remote from #{old_remote} to #{new_remote}..." if $stdout.tty? new_path.git_origin = new_remote end