From 500f9eada854c1939bf9a0caf94085214c9399b0 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Mon, 9 May 2016 20:57:40 +0200 Subject: 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. --- Library/Homebrew/cmd/update.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 44a6ebdf4..9679c0f8e 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -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 /." >&2 echo "So you may need to rename $HOMEBREW_LIBRARY/Taps/$user/homebrew-$repo manually." >&2 -- cgit v1.2.3