From d802b3755a6df6a9c1081061017d1d995c34771a Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Fri, 27 Nov 2020 18:45:59 +1100 Subject: [PATCH] utils/git: remove redundant current_branch --- Library/Homebrew/dev-cmd/pr-pull.rb | 2 +- Library/Homebrew/utils/git.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 02e498baec..8a0e93f946 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -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? diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index 0b9039dfcf..bb8deabe55 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -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