diff options
author | Stan Hu <stanhu@gmail.com> | 2017-11-29 00:03:43 -0500 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-11-30 23:21:44 -0800 |
commit | 66127221fea44fd0dcf35b2ff592f5efe21c530f (patch) | |
tree | 83ac21a2b26e18bda7bfe5517776657c9ba02cf6 /spec | |
parent | 4ab1a1bd1767b6ea408a20dd1af7a0d29af82bfd (diff) | |
download | gitlab-ce-66127221fea44fd0dcf35b2ff592f5efe21c530f.tar.gz |
Gracefully handle case when repository's root ref does not existsh-fix-root-ref-repository
This was failing regularly with an Error 500 when the API branches endpoint
was used.
Closes #40615
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 2f49bd1bcf2..08dd6ea80ff 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1210,6 +1210,16 @@ describe Gitlab::Git::Repository, seed_helper: true do end end + context 'when no root ref is available' do + it 'returns empty list' do + project = create(:project, :empty_repo) + + names = project.repository.merged_branch_names(%w[feature]) + + expect(names).to be_empty + end + end + context 'when no branch names are specified' do before do repository.create_branch('identical', 'master') |