Merge pull request #3925 from maxim-belkin/git_remote_exists_bool

append ? to git_remote_exists
This commit is contained in:
Mike McQuaid 2018-03-15 08:20:14 +00:00 committed by GitHub
commit cb6828dbe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -949,7 +949,7 @@ class ResourceAuditor
problem http_content_problem
end
elsif strategy <= GitDownloadStrategy
unless Utils.git_remote_exists url
unless Utils.git_remote_exists? url
problem "The URL #{url} is not a valid git URL"
end
elsif strategy <= SubversionDownloadStrategy

View File

@ -121,10 +121,10 @@ describe Utils do
end
end
describe "::git_remote_exists" do
describe "::git_remote_exists?" do
it "returns true when git is not available" do
stub_const("HOMEBREW_SHIMS_PATH", HOMEBREW_PREFIX/"bin/shim")
expect(described_class.git_remote_exists("blah")).to be_truthy
expect(described_class.git_remote_exists?("blah")).to be_truthy
end
context "when git is available" do
@ -139,11 +139,11 @@ describe Utils do
system git, "remote", "add", "origin", url
end
expect(described_class.git_remote_exists(url)).to be_truthy
expect(described_class.git_remote_exists?(url)).to be_truthy
end
it "returns false when git remote does not exist" do
expect(described_class.git_remote_exists("blah")).to be_falsey
expect(described_class.git_remote_exists?("blah")).to be_falsey
end
end
end

View File

@ -67,7 +67,7 @@ module Utils
@git_version = nil
end
def self.git_remote_exists(url)
def self.git_remote_exists?(url)
return true unless git_available?
quiet_system "git", "ls-remote", url
end