Keg#replace_text_in_files: fix incorrect replace order
The order of the regexes in `Keg#replace_text_in_files` matters. Otherwise, `/usr/local/Cellar` will be replaced to `@@HOMEBREW_PREFIX@@/Cellar` instead of `@@HOMEBREW_CELLAR@@`. Fixes Homebrew/homebrew-core#26043.
This commit is contained in:
parent
468210840c
commit
6cdc501a75
@ -68,7 +68,7 @@ class Keg
|
||||
relocation.old_cellar => relocation.new_cellar,
|
||||
relocation.old_repository => relocation.new_repository,
|
||||
}
|
||||
changed = s.gsub!(Regexp.union(replacements.keys), replacements)
|
||||
changed = s.gsub!(Regexp.union(replacements.keys.sort_by(&:length).reverse), replacements)
|
||||
next unless changed
|
||||
changed_files += [first, *rest].map { |file| file.relative_path_from(path) }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user