summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-04-13 21:47:52 -0700
committerOswaldo Ferreira <>2019-04-18 22:01:51 -0300
commit54d64ec9f62f5c271b3ed649530a3a2eaa482206 (patch)
tree3d95ada06c8f9685683e7ad902ee43e45b56b59e
parent26653eb0359002e9991bf5089c5505b566125f26 (diff)
downloadgitlab-ce-54d64ec9f62f5c271b3ed649530a3a2eaa482206.tar.gz
Remove source_branch_name commit check
This should already be done in Gitlab::Git:Compare.
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb2
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