From d60020f1a946421cd7af91a50b274b7bce06e78a Mon Sep 17 00:00:00 2001 From: Josh Hagins <hagins.josh@gmail.com> Date: Tue, 1 Nov 2016 11:55:03 -0400 Subject: [PATCH] keg_relocate: fix ordering of replacements --- Library/Homebrew/keg_relocate.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 41686b1bbd..b878781e13 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -66,7 +66,14 @@ class Keg relocation.old_repository => relocation.new_repository, } - regexp = Regexp.union(replacements.keys) + # Order matters here since `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are + # children of `HOMEBREW_PREFIX` by default. + regexp = Regexp.union( + relocation.old_cellar, + relocation.old_repository, + relocation.old_prefix + ) + changed = s.gsub!(regexp, replacements) next unless changed -- GitLab