Browse files

[#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.
  • Loading branch information...
1 parent 6a616a5 commit d943efd0eb701b7d7d31f9b39872678e70743e18 @thegcat thegcat committed Dec 3, 2011
Showing with 1 addition and 6 deletions.
  1. +1 −6 lib/chili_project/version.rb
View
7 lib/chili_project/version.rb
@@ -38,12 +38,7 @@ def self.special
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

0 comments on commit d943efd

Please sign in to comment.