Skip to content

Commit ca459d9

Browse files
sullerandrasmaxjacobson
authored andcommitted
Get git hash from CI first and fall back to Git
1 parent 1ec10f6 commit ca459d9

File tree

1 file changed

+3
-3
lines changed
  • lib/code_climate/test_reporter

1 file changed

+3
-3
lines changed

lib/code_climate/test_reporter/git.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Git
44
class << self
55
def info
66
{
7-
head: head,
7+
head: head_from_ci_or_git,
88
committed_at: committed_at_from_git_or_ci,
99
branch: branch_from_git_or_ci,
1010
}
@@ -34,8 +34,8 @@ def clean_git_branch
3434

3535
private
3636

37-
def head
38-
git("log -1 --pretty=format:'%H'")
37+
def head_from_ci_or_git
38+
Ci.service_data[:commit_sha] || git("log -1 --pretty=format:'%H'")
3939
end
4040

4141
def committed_at_from_ci

0 commit comments

Comments
 (0)