diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-06-07 23:49:53 +0200 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-06-07 23:50:37 +0200 |
commit | bc7f327841f001bf2acdc0d8de622ccee5c45123 (patch) | |
tree | 938f2f912c773c534ca1afcefbc63b985353e40a | |
parent | 1fc42a2c67682c7beaf5443bf8946876320198d9 (diff) | |
download | gitlab-ce-33377-fix-null-ref-in-repo-is-ancestor.tar.gz |
Cleanup and ruby-ism33377-fix-null-ref-in-repo-is-ancestor
-rw-r--r-- | app/models/repository.rb | 5 | ||||
-rw-r--r-- | spec/models/repository_spec.rb | 5 |
2 files changed, 2 insertions, 8 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 98d67002bcb..00a0b407512 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -946,9 +946,8 @@ class Repository end def is_ancestor?(ancestor_id, descendant_id) - if ancestor_id == nil || descendant_id == nil - return false - end + return false if ancestor_id.nil? || descendant_id.nil? + Gitlab::GitalyClient.migrate(:is_ancestor) do |is_enabled| if is_enabled raw_repository.is_ancestor?(ancestor_id, descendant_id) diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 6a5a21558af..a6d4d92c450 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1909,11 +1909,6 @@ describe Repository, models: true do let(:ancestor) { commit.parents.first } context 'with Gitaly enabled' do - before do - #allow(Gitlab::GitalyClient).to receive(:enabled?).and_return(true) - #allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:is_ancestor).and_return(true) - end - it 'it is an ancestor' do expect(repository.is_ancestor?(ancestor.id, commit.id)).to eq(true) end |