Skip to content

Commit

Permalink
#7 more git options
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Mar 11, 2015
1 parent 629e2d2 commit 57a987d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/hoc/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,20 @@ def hits
version = `git --version`.split(/ /)[2]
fail "git version #{version} is too old, upgrade it to 2.0+" unless
Gem::Version.new(version) >= Gem::Version.new('2.0')
log = `git '--git-dir=#{@dir}/.git' log --pretty=tformat: --numstat`
cmd = [
'git',
"'--git-dir=#{@dir}/.git'",
'log', '--pretty=tformat:', '--numstat',
'--ignore-space-change', '--ignore-all-space',
'--ignore-submodules', '--no-color',
'--find-copies-harder', '-M', '--diff-filter=ACDM'
].join(' ')
[
Hits.new(
Time.now,
log.split(/\n/).delete_if(&:empty?).map do |t|
`#{cmd}`.split(/\n/).delete_if(&:empty?).map do |t|
t.split(/\t/).take(2).map { |s| s.to_i }.inject(:+)
end.inject(:+)
end.inject(:+) || 0
)
]
end
Expand Down

0 comments on commit 57a987d

Please sign in to comment.