aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-03-31 10:36:26 +0100
committerMike McQuaid2017-03-31 10:36:26 +0100
commit9b4d57b6df0a1a9d0881b6132fc6113058afe157 (patch)
tree344665ddb229832f3c9436ff57fd60d883578f8b /Library
parent7d07d859ce10f5ea2c94033660674f3bf4ec0ece (diff)
downloadbrew-9b4d57b6df0a1a9d0881b6132fc6113058afe157.tar.bz2
migrator: don't uninstall new_cellar if it existed
Otherwise we could end up removing files unnecessarily.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/migrator.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb
index 17f7ba4b4..3cb6c5178 100644
--- a/Library/Homebrew/migrator.rb
+++ b/Library/Homebrew/migrator.rb
@@ -77,6 +77,9 @@ class Migrator
# path to newname cellar according to new name
attr_reader :new_cellar
+ # true if new cellar existed at initialization time
+ attr_reader :new_cellar_existed
+
# path to newname pin
attr_reader :new_pin_record
@@ -119,6 +122,7 @@ class Migrator
end
@new_cellar = HOMEBREW_CELLAR/formula.name
+ @new_cellar_existed = @new_cellar.exist?
if @old_linked_keg = linked_old_linked_keg
@old_linked_keg_record = old_linked_keg.linked_keg_record if old_linked_keg.linked?
@@ -368,7 +372,7 @@ class Migrator
new_cellar.subdirs.each do |d|
newname_keg = Keg.new(d)
newname_keg.unlink
- newname_keg.uninstall
+ newname_keg.uninstall if new_cellar_existed
end
end