diff --git a/Library/Homebrew/cmd/--repository.sh b/Library/Homebrew/cmd/--repository.sh index 255a52ae7e..81a4ffef11 100644 --- a/Library/Homebrew/cmd/--repository.sh +++ b/Library/Homebrew/cmd/--repository.sh @@ -25,7 +25,7 @@ tap_path() { fi done - repo="${repo#(home|linux)brew-}" + repo="${repo#@(home|linux)brew-}" echo "${HOMEBREW_LIBRARY}/Taps/${user}/homebrew-${repo}" } @@ -38,8 +38,11 @@ homebrew---repository() { return fi - for tap in "$@" - do - tap_path "${tap}" - done + ( + shopt -s extglob + for tap in "$@" + do + tap_path "${tap}" + done + ) } diff --git a/Library/Homebrew/test/cmd/--repository_spec.rb b/Library/Homebrew/test/cmd/--repository_spec.rb index 711dbf8549..d26dd4342b 100644 --- a/Library/Homebrew/test/cmd/--repository_spec.rb +++ b/Library/Homebrew/test/cmd/--repository_spec.rb @@ -14,4 +14,11 @@ RSpec.describe "brew --repository", type: :system do .and not_to_output.to_stderr .and be_a_success end + + it "prints a Tap's repository correctly when homebrew- prefix is supplied", :integration_test do + expect { brew_sh "--repository", "foo/homebrew-bar" } + .to output("#{ENV.fetch("HOMEBREW_LIBRARY")}/Taps/foo/homebrew-bar\n").to_stdout + .and not_to_output.to_stderr + .and be_a_success + end end