tap: return the default_remote if not installed.

Fixes #14656.
This commit is contained in:
Mike McQuaid 2023-02-16 12:25:28 +00:00
parent 6f195c1e6f
commit 53c57d7a70
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
2 changed files with 1 additions and 4 deletions

View File

@ -134,7 +134,7 @@ class Tap
# The remote path to this {Tap}. # The remote path to this {Tap}.
# e.g. `https://github.com/user/homebrew-repo` # e.g. `https://github.com/user/homebrew-repo`
def remote def remote
raise TapUnavailableError, name unless installed? return default_remote unless installed?
@remote ||= path.git_origin @remote ||= path.git_origin
end end

View File

@ -185,7 +185,6 @@ describe Tap do
setup_git_repo setup_git_repo
expect(homebrew_foo_tap.remote).to eq("https://github.com/Homebrew/homebrew-foo") expect(homebrew_foo_tap.remote).to eq("https://github.com/Homebrew/homebrew-foo")
expect { described_class.new("Homebrew", "bar").remote }.to raise_error(TapUnavailableError)
expect(homebrew_foo_tap).not_to have_custom_remote expect(homebrew_foo_tap).not_to have_custom_remote
services_tap = described_class.new("Homebrew", "services") services_tap = described_class.new("Homebrew", "services")
@ -213,7 +212,6 @@ describe Tap do
setup_git_repo setup_git_repo
expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo") expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo")
expect { described_class.new("Homebrew", "bar").remote_repo }.to raise_error(TapUnavailableError)
services_tap = described_class.new("Homebrew", "services") services_tap = described_class.new("Homebrew", "services")
services_tap.path.mkpath services_tap.path.mkpath
@ -228,7 +226,6 @@ describe Tap do
setup_git_repo setup_git_repo
expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo") expect(homebrew_foo_tap.remote_repo).to eq("Homebrew/homebrew-foo")
expect { described_class.new("Homebrew", "bar").remote_repo }.to raise_error(TapUnavailableError)
services_tap = described_class.new("Homebrew", "services") services_tap = described_class.new("Homebrew", "services")
services_tap.path.mkpath services_tap.path.mkpath