diff options
-rw-r--r-- | lib/gitlab/git/repository.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 6cebc9ac9eb..d7f5720c795 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -733,8 +733,6 @@ module Gitlab def compare_source_branch(target_branch_name, source_repository, source_branch_name, straight:) if source_repository == self - return unless commit(source_branch_name).present? - return Gitlab::Git::Compare.new(self, target_branch_name, source_branch_name, straight: straight) end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 85c45ea4183..a98b04feb9c 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1980,7 +1980,7 @@ describe Gitlab::Git::Repository, :seed_helper do it 'returns nil when source ref does not exist' do compare = repository.compare_source_branch('master', repository, 'non-existent-branch', straight: false) - expect(compare).to be_nil + expect(compare.commits).to be_empty end end |