keg_relocate: fix ordering of replacements

This commit is contained in:
Josh Hagins 2016-11-01 11:55:03 -04:00
parent 8d5df2ea87
commit d60020f1a9

View File

@ -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