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

Commit 61765ce

Browse files
author
Strech (Sergey Fedorov)
committed
Fixed broken .git dir for Rails dummy apps
1 parent c7919fc commit 61765ce

File tree

1 file changed

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

1 file changed

+10
-7
lines changed

lib/code_climate/test_reporter/git.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,20 @@ def git(command)
4949
end
5050

5151
def git_dir
52-
return CodeClimate::TestReporter.configuration.git_dir unless CodeClimate::TestReporter.configuration.git_dir.nil?
53-
54-
root = "."
52+
return configured_git_dir unless configured_git_dir.nil?
53+
rails_git_dir_present? ? Rails.root : '.'
54+
end
5555

56-
if defined?(Rails) && File.directory?(File.expand_path(".git", Rails.root))
57-
root = Rails.root
58-
end
56+
def configured_git_dir
57+
CodeClimate::TestReporter.configuration.git_dir
58+
end
5959

60-
root
60+
def rails_git_dir_present?
61+
defined?(Rails) && !Rails.root.nil? &&
62+
File.directory?(File.expand_path('.git', Rails.root))
6163
end
6264
end
6365
end
6466
end
6567
end
68+

0 commit comments

Comments
 (0)