Merge pull request #4046 from xu-cheng/keg_relocate

Keg#replace_text_in_files: fix incorrect replace order
This commit is contained in:
Mike McQuaid 2018-04-10 10:19:50 -07:00 committed by GitHub
commit 07794cd7f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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