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
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2019-02-28 20:57:56 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-02-28 20:57:56 +0300
commit60928cb31b97c0db4a2ead8912e818272ce7801d (patch)
tree92671a0be1bf923c532f1fbf9ec7a5c7594a9973
parent9bcf6cc06a381b12558a386c5bc8a91c3ceb3608 (diff)
parent348a6c1e4708d1cb832b89138d3b57639ff71aed (diff)
Merge branch 'zj-remove-dead-commmit-stats-ruby' into 'master'
Remove unused Ruby implementation for CommitStats Closes #1471 See merge request gitlab-org/gitaly!1092
-rw-r--r--changelogs/unreleased/zj-remove-dead-commmit-stats-ruby.yml5
-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
5 files changed, 5 insertions, 78 deletions
diff --git a/changelogs/unreleased/zj-remove-dead-commmit-stats-ruby.yml b/changelogs/unreleased/zj-remove-dead-commmit-stats-ruby.yml
new file mode 100644
index 000000000..24e4c4d40
--- /dev/null
+++ b/changelogs/unreleased/zj-remove-dead-commmit-stats-ruby.yml
@@ -0,0 +1,5 @@
+---
+title: Remove unused Ruby implementation for CommitStats
+merge_request: 1092
+author:
+type: other
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 }