aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJosh Hagins2016-11-01 11:55:03 -0400
committerJosh Hagins2016-11-01 12:07:14 -0400
commitd60020f1a946421cd7af91a50b274b7bce06e78a (patch)
treeca7f8c3883d8ea32334af106cace3dff7e3a877a /Library
parent8d5df2ea8769f48fc8b9c145abc8fc1329a650cb (diff)
downloadbrew-d60020f1a946421cd7af91a50b274b7bce06e78a.tar.bz2
keg_relocate: fix ordering of replacements
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg_relocate.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 41686b1bb..b878781e1 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