pull: fix tap name for linuxbrew
This commit is contained in:
parent
cd6a518a22
commit
45c61cdcdb
@ -109,10 +109,10 @@ module Homebrew
|
|||||||
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
elsif (api_match = arg.match HOMEBREW_PULL_API_REGEX)
|
||||||
_, user, repo, issue = *api_match
|
_, user, repo, issue = *api_match
|
||||||
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
url = "https://github.com/#{user}/#{repo}/pull/#{issue}"
|
||||||
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
|
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
|
||||||
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
|
elsif (url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX)
|
||||||
url, user, repo, issue = *url_match
|
url, user, repo, issue = *url_match
|
||||||
tap = Tap.fetch(user, repo) if repo.start_with?("homebrew-")
|
tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
|
||||||
else
|
else
|
||||||
odie "Not a GitHub pull request or commit: #{arg}"
|
odie "Not a GitHub pull request or commit: #{arg}"
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ class Tap
|
|||||||
|
|
||||||
# We special case homebrew and linuxbrew so that 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 = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
user = user.capitalize if ["homebrew", "linuxbrew"].include? user
|
||||||
repo = repo.delete_prefix "homebrew-"
|
repo = repo.sub(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX, "")
|
||||||
|
|
||||||
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
return CoreTap.instance if ["Homebrew", "Linuxbrew"].include?(user) && ["core", "homebrew"].include?(repo)
|
||||||
|
|
||||||
|
@ -8,3 +8,4 @@ HOMEBREW_TAP_DIR_REGEX = %r{#{Regexp.escape(HOMEBREW_LIBRARY)}/Taps/(?<user>[\w-
|
|||||||
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
|
HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source + %r{(?:/.*)?$}.source)
|
||||||
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
# match official taps' casks, e.g. homebrew/cask/somecask or homebrew/cask-versions/somecask
|
||||||
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
|
HOMEBREW_CASK_TAP_CASK_REGEX = %r{^(?:([Cc]askroom)/(cask|versions)|(homebrew)/(cask|cask-[\w-]+))/([\w+-.]+)$}.freeze
|
||||||
|
HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX = /^(home|linux)brew-/.freeze
|
||||||
|
Loading…
x
Reference in New Issue
Block a user