Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-02-25 14:22:41 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-02-26 16:37:18 +0300
commit348a6c1e4708d1cb832b89138d3b57639ff71aed (patch)
treeee4e7e6ab8c617a7b04fd90601ce95bf7d78f9e5 /ruby
parentc2985e16dc51fe7c4b2ec4bbc3688b131a6341bc (diff)
Remove unused Ruby implementation for CommitStats
Commit stats are new served by Go, and the implementation can be removed from the Ruby sidecar. MR of the Go port: https://gitlab.com/gitlab-org/gitaly/merge_requests/1048 Closes https://gitlab.com/gitlab-org/gitaly/issues/1471
Diffstat (limited to 'ruby')
-rw-r--r--ruby/lib/gitaly_server/commit_service.rb18
-rw-r--r--ruby/lib/gitlab/git/commit.rb10
-rw-r--r--ruby/lib/gitlab/git/commit_stats.rb27
-rw-r--r--ruby/spec/lib/gitlab/git/commit_spec.rb23
4 files changed, 0 insertions, 78 deletions
diff --git a/ruby/lib/gitaly_server/commit_service.rb b/ruby/lib/gitaly_server/commit_service.rb
index e4916ec70..1aed50b3e 100644
--- a/ruby/lib/gitaly_server/commit_service.rb
+++ b/ruby/lib/gitaly_server/commit_service.rb
@@ -3,24 +3,6 @@ module GitalyServer
include Utils
include Gitlab::EncodingHelper
- # TODO remove in gitlab 12.0, this is implemented in Go now:
- # https://gitlab.com/gitlab-org/gitaly/issues/1471
- def commit_stats(request, call)
- repo = Gitlab::Git::Repository.from_gitaly(request.repository, call)
- revision = request.revision unless request.revision.empty?
-
- commit = Gitlab::Git::Commit.find(repo, revision)
-
- # In the odd case that the revision given doesn't exist we need to raise
- # an exception. Since GitLab (currently) already does this for us we don't
- # expect this to actually happen, just guarding against future code change
- raise GRPC::Internal.new("commit not found for revision '#{revision}'") unless commit
-
- stats = Gitlab::Git::CommitStats.new(repo, commit)
-
- Gitaly::CommitStatsResponse.new(oid: stats.id, additions: stats.additions, deletions: stats.deletions)
- end
-
def find_commits(request, call)
repository = Gitlab::Git::Repository.from_gitaly(request.repository, call)
options = {
diff --git a/ruby/lib/gitlab/git/commit.rb b/ruby/lib/gitlab/git/commit.rb
index c163e9e6e..9a420c04b 100644
--- a/ruby/lib/gitlab/git/commit.rb
+++ b/ruby/lib/gitlab/git/commit.rb
@@ -133,12 +133,6 @@ module Gitlab
diff
end
- def has_zero_stats?
- stats.total.zero?
- rescue
- true
- end
-
def no_commit_message
"--no commit message"
end
@@ -157,10 +151,6 @@ module Gitlab
parent_ids.map { |oid| self.class.find(@repository, oid) }.compact
end
- def stats
- Gitlab::Git::CommitStats.new(@repository, self)
- end
-
def message
encode! @message
end
diff --git a/ruby/lib/gitlab/git/commit_stats.rb b/ruby/lib/gitlab/git/commit_stats.rb
deleted file mode 100644
index 1959233e1..000000000
--- a/ruby/lib/gitlab/git/commit_stats.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# Gitlab::Git::CommitStats counts the additions, deletions, and total changes
-# in a commit.
-module Gitlab
- module Git
- class CommitStats
- attr_reader :id, :additions, :deletions, :total
-
- # Instantiate a CommitStats object
- #
- # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/323
- def initialize(_repo, commit)
- @id = commit.id
- @additions = 0
- @deletions = 0
- @total = 0
-
- rugged_stats(commit)
- end
-
- def rugged_stats(commit)
- diff = commit.rugged_diff_from_parent
- _files_changed, @additions, @deletions = diff.stat
- @total = @additions + @deletions
- end
- end
- end
-end
diff --git a/ruby/spec/lib/gitlab/git/commit_spec.rb b/ruby/spec/lib/gitlab/git/commit_spec.rb
index b46346353..217e226b9 100644
--- a/ruby/spec/lib/gitlab/git/commit_spec.rb
+++ b/ruby/spec/lib/gitlab/git/commit_spec.rb
@@ -168,29 +168,6 @@ describe Gitlab::Git::Commit do
end
end
- describe '#stats' do
- subject { commit.stats }
-
- describe '#additions' do
- subject { super().additions }
- it { is_expected.to eq(11) }
- end
-
- describe '#deletions' do
- subject { super().deletions }
- it { is_expected.to eq(6) }
- end
-
- describe '#total' do
- subject { super().total }
- it { is_expected.to eq(17) }
- end
- end
-
- describe '#has_zero_stats?' do
- it { expect(commit.has_zero_stats?).to eq(false) }
- end
-
describe '#to_hash' do
let(:hash) { commit.to_hash }
subject { hash }