From d943efd0eb701b7d7d31f9b39872678e70743e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Sat, 3 Dec 2011 17:39:52 +0100 Subject: [PATCH] [#748] Make ChiliProject::Version.revision more resilient * Won't output errors when the ChiliProject git repo isn't there anymore, * Works even if not invoked from the ChiliProject root directory, * Moved the formatting logic to the git call. --- lib/chili_project/version.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/chili_project/version.rb b/lib/chili_project/version.rb index 5aee2bed..601449ea 100644 --- a/lib/chili_project/version.rb +++ b/lib/chili_project/version.rb @@ -38,12 +38,7 @@ module ChiliProject end def self.revision - revision = `git rev-parse HEAD` - if revision.present? - revision.strip[0..8] - else - nil - end + `git --git-dir="#{Rails.root.join('.git')}" rev-parse --short=9 HEAD`.chomp if File.directory? Rails.root.join('.git') end REVISION = self.revision