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

Commit a27b345

Browse files
author
David Rodríguez de Dios
committed
Ensure timestamp always properly converted to int
In windows, `git log -1 --pretty=format:'%ct'` would sometimes return the timestamp surrounded by quotes, so it wouldn't be properly converted to an integer. The new command seems to work in all cases.
1 parent 209b035 commit a27b345

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/code_climate/test_reporter/git.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def clean_git_branch
3232
private
3333

3434
def committed_at
35-
committed_at = `git log -1 --pretty=format:'%ct'`
35+
committed_at = `git log -1 --pretty=format:%ct`
3636
committed_at.to_i.zero? ? nil : committed_at.to_i
3737
end
3838

spec/lib/git_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module CodeClimate::TestReporter
66
it 'returns a hash with git information.' do
77
expected_git_hash = {
88
head: `git log -1 --pretty=format:'%H'`,
9-
committed_at: `git log -1 --pretty=format:'%ct'`.to_i,
9+
committed_at: `git log -1 --pretty=format:%ct`.to_i,
1010
branch: Git.send(:branch_from_git)
1111
}
1212

0 commit comments

Comments
 (0)