Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit f31c043

Browse files
committed
Merge pull request #65 from codeclimate/check_git_dir
Check that the `.git` directory exists when Rails.root is defined.
2 parents 7e5951d + 7eeff8c commit f31c043

File tree

1 file changed

+7
-1
lines changed
  • lib/code_climate/test_reporter

1 file changed

+7
-1
lines changed

lib/code_climate/test_reporter/git.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def git(command)
4949
end
5050

5151
def git_dir
52-
defined?(Rails) ? Rails.root : '.'
52+
root = "."
53+
54+
if defined?(Rails) && File.directory?(File.expand_path(".git", Rails.root))
55+
root = Rails.root
56+
end
57+
58+
root
5359
end
5460
end
5561
end

0 commit comments

Comments
 (0)