summaryrefslogtreecommitdiff
path: root/lib/bundler/build_metadata.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/build_metadata.rb')
-rw-r--r--lib/bundler/build_metadata.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb
index 0846e82e06..5d2a8b53bb 100644
--- a/lib/bundler/build_metadata.rb
+++ b/lib/bundler/build_metadata.rb
@@ -27,9 +27,9 @@ module Bundler
# If Bundler has been installed without its .git directory and without a
# commit instance variable then we can't determine its commits SHA.
- git_dir = File.join(File.expand_path("../../../..", __FILE__), ".git")
+ git_dir = File.expand_path("../../../.git", __dir__)
if File.directory?(git_dir)
- return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze }
+ return @git_commit_sha = IO.popen(%w[git rev-parse --short HEAD], { chdir: git_dir }, &:read).strip.freeze
end
@git_commit_sha ||= "unknown"