aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2015-08-24 20:10:53 -0700
committerMisty De Meo2015-08-24 20:10:53 -0700
commit98bb638f29786cea209ee78f5caa7dda354e6ea5 (patch)
tree5abb8c3993e298d53d33ef2578c4d5f65fda54c2 /Library
parentcb154116c551c68f8ae0533ae9fa35ba3e903599 (diff)
downloadbrew-98bb638f29786cea209ee78f5caa7dda354e6ea5.tar.bz2
Formula#file_modified?: fix for Xcodes without git
Fixes Homebrew/homebrew#43206.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 8fba7803b..c9e931311 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -765,10 +765,15 @@ class Formula
end
def file_modified?
- git_dir = MacOS.locate("git").dirname.to_s
+ # New Homebrew installs may not be a git repo yet
+ return false unless File.exist? "#{HOMEBREW_PREFIX}/.git"
+
+ git = MacOS.locate("git")
+ # git isn't installed by older Xcodes
+ return false if git.nil?
# /usr/bin/git is a popup stub when Xcode/CLT aren't installed, so bail out
- return false if git_dir == "/usr/bin" && !MacOS.has_apple_developer_tools?
+ return false if git.dirname.to_s == "/usr/bin" && !MacOS.has_apple_developer_tools?
path.parent.cd do
diff = Utils.popen_read("git", "diff", "origin/master", "--", "#{path}")