utils/git: remove redundant current_branch

This commit is contained in:
Jonathan Chang 2020-11-27 18:45:59 +11:00
parent 5bda84b594
commit d802b3755a
2 changed files with 3 additions and 2 deletions

View File

@ -385,7 +385,7 @@ module Homebrew
_, user, repo, pr = *url_match
odie "Not a GitHub pull request: #{arg}" unless pr
current_branch = Utils::Git.current_branch(tap.path)
current_branch = tap.path.git_branch
origin_branch = Utils::Git.origin_branch(tap.path).split("/").last
if current_branch != origin_branch || args.branch_okay? || args.clean?

View File

@ -140,7 +140,8 @@ module Utils
end
def current_branch(repo)
Utils.popen_read("git", "-C", repo, "symbolic-ref", "--short", "HEAD").chomp.presence
odeprecated "Utils::Git.current_branch(repo)", "Pathname(repo).git_branch"
Pathname(repo).extend(GitRepositoryExtension).git_branch
end
# Special case of `git cherry-pick` that permits non-verbose output and