Merge pull request #3337 from sjackman/pull

pull: Fix pull --bottle 1234
This commit is contained in:
Mike McQuaid 2017-10-22 19:40:24 +01:00 committed by GitHub
commit 7e4f42369f
4 changed files with 7 additions and 9 deletions

View File

@ -87,11 +87,8 @@ module Homebrew
tap = nil tap = nil
ARGV.named.each do |arg| ARGV.named.each do |arg|
if arg.to_i.positive? arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive?
issue = arg if (testing_match = arg.match %r{/job/Homebrew.*Testing/(\d+)/})
url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}"
tap = CoreTap.instance
elsif (testing_match = arg.match %r{/job/Homebrew.*Testing/(\d+)/})
tap = ARGV.value("tap") tap = ARGV.value("tap")
tap = if tap&.start_with?("homebrew/") tap = if tap&.start_with?("homebrew/")
Tap.fetch("homebrew", tap.strip_prefix("homebrew/")) Tap.fetch("homebrew", tap.strip_prefix("homebrew/"))

View File

@ -26,11 +26,11 @@ class Tap
raise "Invalid tap name '#{args.join("/")}'" raise "Invalid tap name '#{args.join("/")}'"
end end
# we special case homebrew so users don't have to shift in a terminal # We special case homebrew and linuxbrew so that users don't have to shift in a terminal.
user = "Homebrew" if user == "homebrew" user = user.capitalize if ["homebrew", "linuxbrew"].include? user
repo = repo.strip_prefix "homebrew-" repo = repo.strip_prefix "homebrew-"
if user == "Homebrew" && (repo == "homebrew" || repo == "core") if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
return CoreTap.instance return CoreTap.instance
end end

View File

@ -22,7 +22,7 @@ describe "brew pull", :integration_test do
.and output(/Current branch is new\-branch/).to_stderr .and output(/Current branch is new\-branch/).to_stderr
.and be_a_failure .and be_a_failure
expect { brew "pull", "--bump", "8" } expect { brew "pull", "--bump", "https://github.com/Homebrew/homebrew-core/pull/8" }
.to output(/Fetching patch/).to_stdout .to output(/Fetching patch/).to_stdout
.and output(/No changed formulae found to bump/).to_stderr .and output(/No changed formulae found to bump/).to_stderr
.and be_a_failure .and be_a_failure

View File

@ -61,6 +61,7 @@ describe Tap do
specify "::fetch" do specify "::fetch" do
begin begin
expect(described_class.fetch("Homebrew", "core")).to be_kind_of(CoreTap)
expect(described_class.fetch("Homebrew", "homebrew")).to be_kind_of(CoreTap) expect(described_class.fetch("Homebrew", "homebrew")).to be_kind_of(CoreTap)
tap = described_class.fetch("Homebrew", "foo") tap = described_class.fetch("Homebrew", "foo")
expect(tap).to be_kind_of(Tap) expect(tap).to be_kind_of(Tap)