From 4aedeea96d4c9d9c20bc822d520e453ac8964c56 Mon Sep 17 00:00:00 2001
From: Vlad Shablinsky <vladshablinsky@gmail.com>
Date: Fri, 1 Jul 2016 18:02:31 +0300
Subject: [PATCH] formula: simplify migration_needed?

---
 Library/Homebrew/formula.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index cb58824f3d..25797c8d97 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -957,8 +957,14 @@ class Formula
   end
 
   def migration_needed?
-    oldname && !rack.exist? && (dir = HOMEBREW_CELLAR/oldname).directory? &&
-      !dir.subdirs.empty? && tap == Tab.for_keg(dir.subdirs.first).tap
+    return false unless oldname
+    return false if rack.exist?
+
+    old_rack = HOMEBREW_CELLAR/oldname
+    return false unless old_rack.directory?
+    return false if old_rack.subdirs.empty?
+
+    tap == Tab.for_keg(old_rack.subdirs.first).tap
   end
 
   # @private
-- 
GitLab