diff options
| author | Shaun Jackman | 2017-05-17 23:55:29 -0700 |
|---|---|---|
| committer | Shaun Jackman | 2017-05-17 23:55:29 -0700 |
| commit | 175c2e9303fe14e40a7d33c4f736ce270add6511 (patch) | |
| tree | abd3e2d3eabef9ee8b789e564497ade75a168a01 /Library | |
| parent | 29429df9da748570a5046a99b683ebc3979531a4 (diff) | |
| download | brew-175c2e9303fe14e40a7d33c4f736ce270add6511.tar.bz2 | |
replace_text_in_files: Regex match is greedy
The regex matches the longest possible string. Order does not matter.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg_relocate.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 6044426ee..a04bae7b6 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -68,17 +68,7 @@ class Keg relocation.old_cellar => relocation.new_cellar, relocation.old_repository => relocation.new_repository, } - - # 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) - + changed = s.gsub!(Regexp.union(replacements.keys), replacements) next unless changed changed_files += [first, *rest].map { |file| file.relative_path_from(path) } |
