diff options
author | Robert Speicher <robert@gitlab.com> | 2018-01-03 17:39:24 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-01-03 17:39:24 +0000 |
commit | 946a3634bc5a851944e5cc7fe8fdb5341ca5176b (patch) | |
tree | 9f524c93d227e92f272435f9443f5fd1a23bea31 /lib | |
parent | f7cb21930abaaa94118c1981149010abdd62de1a (diff) | |
parent | 25a868753b4b9e673af31f7f4f58f9e97811e9d9 (diff) | |
download | gitlab-ce-946a3634bc5a851944e5cc7fe8fdb5341ca5176b.tar.gz |
Merge branch 'sh-optimize-commit-stats' into 'master'
Speed up generation of commit stats by using Rugged native methods
See merge request gitlab-org/gitlab-ce!16186
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/commit_stats.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/gitlab/git/commit_stats.rb b/lib/gitlab/git/commit_stats.rb index 6bf49a0af18..8463b1eb794 100644 --- a/lib/gitlab/git/commit_stats.rb +++ b/lib/gitlab/git/commit_stats.rb @@ -34,13 +34,8 @@ module Gitlab def rugged_stats(commit) diff = commit.rugged_diff_from_parent - - diff.each_patch do |p| - # TODO: Use the new Rugged convenience methods when they're released - @additions += p.stat[0] - @deletions += p.stat[1] - @total += p.changes - end + _files_changed, @additions, @deletions = diff.stat + @total = @additions + @deletions end end end |