From f1bf81dd55928464a654b84d171e191b0438a5f1 Mon Sep 17 00:00:00 2001
From: Jack Nagel <jacknagel@gmail.com>
Date: Sun, 21 Jun 2015 21:18:24 -0400
Subject: [PATCH] Simplify gcc_version_formula

---
 Library/Homebrew/extend/ENV/shared.rb | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb
index c886c43125..f75d40ecf6 100644
--- a/Library/Homebrew/extend/ENV/shared.rb
+++ b/Library/Homebrew/extend/ENV/shared.rb
@@ -192,20 +192,10 @@ module SharedEnvExtension
     version = name[GNU_GCC_REGEXP, 1]
     gcc_version_name = "gcc#{version.delete('.')}"
 
-    gcc_path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", name)
-    gcc_formula = Formulary.factory "gcc"
-    gcc_versions_path = HOMEBREW_PREFIX.join("opt", gcc_version_name, "bin", name)
-
-    if gcc_path.exist?
-      gcc_formula
-    elsif gcc_versions_path.exist?
-      Formulary.factory gcc_version_name
-    elsif gcc_formula.version.to_s.include?(version)
-      gcc_formula
-    elsif (gcc_versions_formula = Formulary.factory(gcc_version_name) rescue nil)
-      gcc_versions_formula
+    if HOMEBREW_PREFIX.join("opt", "gcc", "bin", name).exist?
+      Formulary.factory("gcc")
     else
-      gcc_formula
+      Formulary.factory(gcc_version_name)
     end
   end
 
-- 
GitLab