Skip to content

Commit

Permalink
Merge pull request #18538 from dawidd6/patch-1
Browse files Browse the repository at this point in the history
dev-cmd/bump-formula-pr: always use full git repo as tap remote
  • Loading branch information
MikeMcQuaid authored Oct 15, 2024
2 parents 58b03ed + 02cef96 commit b72efbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/bump-formula-pr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def run
# spamming during normal output.
Homebrew.install_bundler_gems!(groups: ["audit", "style"]) unless args.no_audit?

tap_remote_repo = formula.tap.full_name || formula.tap.remote_repository
tap_remote_repo = formula.tap.remote_repository
remote = "origin"
remote_branch = formula.tap.git_repository.origin_branch_name
previous_branch = "-"
Expand Down
5 changes: 2 additions & 3 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ def remote
sig { returns(T.nilable(String)) }
def remote_repository
return unless (remote = self.remote)
return unless (match = remote.match(HOMEBREW_TAP_REPOSITORY_REGEX))

@remote_repository ||= remote.delete_prefix("https://github.com/")
.delete_prefix("[email protected]:")
.delete_suffix(".git")
@remote_repository ||= T.must(match[:remote_repository])
end

# @deprecated
Expand Down
5 changes: 5 additions & 0 deletions Library/Homebrew/tap_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
%r{\A(?:[Hh]omebrew/(?:homebrew-)?core/)?(?<name>#{HOMEBREW_TAP_FORMULA_NAME_REGEX.source})\Z},
Regexp,
)
# Match taps' remote repository, e.g. `someuser/somerepo`.
HOMEBREW_TAP_REPOSITORY_REGEX = T.let(
%r{\A.+[/:](?<remote_repository>[^/:]+/[^/:]+?(?=\.git/*\Z|/*\Z))},
Regexp,
)

# Match a cask token.
HOMEBREW_TAP_CASK_TOKEN_REGEX = T.let(/(?<token>[\w+\-.@]+)/, Regexp)
Expand Down

0 comments on commit b72efbd

Please sign in to comment.