summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-12-01 11:02:32 +0000
committerRémy Coutable <remy@rymai.me>2017-12-01 11:02:32 +0000
commit3e78b5ae8f99b18e05e4d35068cbc0785178ba4b (patch)
tree9253e70efff9815909e723ca53a3abf2217ef350 /spec
parentf999fa4c11db5425d0279dfb418544dd5d8bfa3d (diff)
parent66127221fea44fd0dcf35b2ff592f5efe21c530f (diff)
downloadgitlab-ce-3e78b5ae8f99b18e05e4d35068cbc0785178ba4b.tar.gz
Merge branch 'sh-fix-root-ref-repository' into 'master'
Gracefully handle case when repository's root ref does not exist Closes #40615 See merge request gitlab-org/gitlab-ce!15678
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb10
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')