diff options
| author | Mike McQuaid | 2017-05-20 10:57:41 +0100 |
|---|---|---|
| committer | GitHub | 2017-05-20 10:57:41 +0100 |
| commit | 7000f50d5f79cb9c6b1e2d53a0cc9ec8283fd3ec (patch) | |
| tree | a6c80cdae56347dfdb7477d2f22cbbe00c6579d2 | |
| parent | a7c6a57c8ea6314d5e1aa25e43d2b4a447b591a8 (diff) | |
| parent | 175c2e9303fe14e40a7d33c4f736ce270add6511 (diff) | |
| download | brew-7000f50d5f79cb9c6b1e2d53a0cc9ec8283fd3ec.tar.bz2 | |
Merge pull request #2646 from sjackman/replace_text_in_files
replace_text_in_files: Regex match is greedy
| -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) } |
