Skip to content
Snippets Groups Projects
Commit 682f0e97 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin :palm_tree:
Browse files

Remove the temporary patch for "listing commits failed" error

Contributes to #452488

**Problem**

gitaly!6590 introduced a
bug that was raising a `listing commits` error if the repository was
empty.

I fixed it by adding an error handler for this error.

**Solution**

This original bug was fixed on Gitaly side:
gitaly!6801. The Rails
patch is not necessary anymore.

Changelog: other
parent d58eac93
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !148979. Comments created here will be created in the context of that merge request.
...@@ -171,11 +171,6 @@ def commits(ref = nil, opts = {}) ...@@ -171,11 +171,6 @@ def commits(ref = nil, opts = {})
commits = Commit.decorate(commits, container) if commits.present? commits = Commit.decorate(commits, container) if commits.present?
CommitCollection.new(container, commits, ref) CommitCollection.new(container, commits, ref)
rescue Gitlab::Git::CommandError => e
# Temporary fix to address a new Gitaly internal error: https://gitlab.com/gitlab-org/gitlab/-/issues/452488
return CommitCollection.new(container, [], ref) if e.message.include?('listing commits failed')
raise
end end
def commits_between(from, to, limit: nil) def commits_between(from, to, limit: nil)
......
...@@ -386,26 +386,6 @@ def expect_to_raise_storage_error ...@@ -386,26 +386,6 @@ def expect_to_raise_storage_error
end end
end end
context 'when Gitaly raises a CommandError error' do
let(:error_message) { 'Boom' }
before do
expect(Gitlab::Git::Commit).to receive(:where).and_raise(Gitlab::Git::CommandError, error_message)
end
it 're-raises an error' do
expect { repository.commits('master', limit: 60) }.to raise_error(Gitlab::Git::CommandError, error_message)
end
context 'when error contains "listing commits failed" message' do
let(:error_message) { 'listing commits failed' }
it 'returns an empty collection' do
expect(repository.commits('master', limit: 60).to_a).to eq([])
end
end
end
context 'when ref is passed' do context 'when ref is passed' do
it 'returns every commit from the specified ref' do it 'returns every commit from the specified ref' do
expect(repository.commits('master', limit: 60).size).to eq(37) expect(repository.commits('master', limit: 60).size).to eq(37)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment