mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 06:21:23 +00:00
Handle missing git binary in commit_sha initializer
Rescues Errno::ENOENT when git is not installed, falling back to BUILD_COMMIT_SHA env var or "unknown". Fixes crash in Docker development containers that lack git.
This commit is contained in:
@@ -8,8 +8,10 @@ module Sure
|
||||
if Rails.env.production?
|
||||
ENV["BUILD_COMMIT_SHA"]
|
||||
else
|
||||
`git rev-parse HEAD`.chomp
|
||||
ENV["BUILD_COMMIT_SHA"] || `git rev-parse HEAD`.chomp
|
||||
end
|
||||
rescue Errno::ENOENT
|
||||
ENV.fetch("BUILD_COMMIT_SHA", "unknown")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user