summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/build_metadata.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb
index a0428f0319..c9d7482b24 100644
--- a/lib/bundler/build_metadata.rb
+++ b/lib/bundler/build_metadata.rb
@@ -28,7 +28,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")
- return "unknown" unless File.directory?(git_dir)
+ # Check for both a file or folder because RubyGems runs Bundler's test suite in a submodule
+ # which does not have a .git folder
+ return "unknown" unless File.exist?(git_dir)
# Otherwise shell out to git.
@git_commit_sha = Dir.chdir(File.expand_path("..", __FILE__)) do