update: fix hyphen counting (legacy tap renaming)

Fix regression introduced in fafe8f0f53bf91fc41f016b5c2af41ca712783f7.
Counting the number of hyphens in a string cannot be done in a single
expression, thus split this and introduce another local variable.

Fixes #227.
This commit is contained in:
Martin Afanasjew 2016-05-09 20:57:40 +02:00
parent 93e0f4f946
commit 500f9eada8

View File

@ -40,6 +40,7 @@ git_init_if_necessary() {
rename_taps_dir_if_necessary() {
local tap_dir
local tap_dir_basename
local tap_dir_hyphens
local user
local repo
@ -55,7 +56,8 @@ rename_taps_dir_if_necessary() {
mkdir -p "$HOMEBREW_LIBRARY/Taps/$user"
mv "$tap_dir" "$HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo"
if [[ ${#${tap_dir_basename//[^\-]}} -gt 1 ]]
tap_dir_hyphens="${tap_dir_basename//[^\-]}"
if [[ ${#tap_dir_hyphens} -gt 1 ]]
then
echo "Homebrew changed the structure of Taps like <someuser>/<sometap>." >&2
echo "So you may need to rename $HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo manually." >&2