diff options
| author | Jack Nagel | 2014-03-27 21:42:09 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-03-27 21:42:09 -0500 |
| commit | 0d32cafc7a89b8996cef2d4f7d4c18a65a798b82 (patch) | |
| tree | 0d8cfed8fc36890f3e18ce74b61d3a61191f3dae /Library | |
| parent | b81a42fdd4cf9dcf86d04d4a02617e4feea7b29a (diff) | |
| download | homebrew-0d32cafc7a89b8996cef2d4f7d4c18a65a798b82.tar.bz2 | |
Only write files if we actually made a change
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index f490a9c79..7356efcd2 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -42,10 +42,13 @@ class Keg files.group_by { |f| f.stat.ino }.each_value do |first, *rest| s = first.open("rb", &:read) - s.gsub!(old_cellar, new_cellar) - s.gsub!(old_prefix, new_prefix) - first.atomic_write(s) - rest.each { |file| FileUtils.ln(first, file, :force => true) } + changed = s.gsub!(old_cellar, new_cellar) + changed = s.gsub!(old_prefix, new_prefix) || changed + + if changed + first.atomic_write(s) + rest.each { |file| FileUtils.ln(first, file, :force => true) } + end end end |
