From 3f84dd066f6f0b3e7ca5233ca765b2663f9c9688 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Tue, 30 Aug 2011 21:51:33 -0700 Subject: [PATCH] can't access git on heroku --- config/initializers/git_info.rb | 40 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/config/initializers/git_info.rb b/config/initializers/git_info.rb index 1b5f24cef..885e3a91b 100644 --- a/config/initializers/git_info.rb +++ b/config/initializers/git_info.rb @@ -2,22 +2,26 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. -s = `git show --name-only 2>/dev/null || :` -if (s.nil? or s.empty?) - path = File.expand_path("config/gitversion") - begin - if (File.exists?( path)) - s = '' - f = File.open( path) - f.each_line do |line| - s += line - end - f.close - end - rescue - s = "" - end +unless ENV['HEROKU'] + s = `git show --name-only 2>/dev/null || :` + if (s.nil? or s.empty?) + path = File.expand_path("config/gitversion") + begin + if (File.exists?( path)) + s = '' + f = File.open( path) + f.each_line do |line| + s += line + end + f.close + end + rescue + s = "" + end + end + GIT_INFO = s + # What's the scope of this s? Leave to GC just in case... + s = nil +else + GIT_INFO = nil end -GIT_INFO = s -# What's the scope of this s? Leave to GC just in case... -s = nil