From b25156ca4a0213e3e1c31662e2d88fa1155c1242 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 27 Mar 2014 21:42:09 -0500 Subject: [PATCH] Only write files if we actually made a change --- Library/Homebrew/keg_fix_install_names.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index f490a9c790..7356efcd20 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