Commit 54d74a4f authored by Jarka Košanová's avatar Jarka Košanová

Merge branch '21686_filter_duplicates' into 'master'

Remove duplicates from related_commit_sha query

See merge request gitlab-org/gitlab!51888
parents 62f8dab1 5ec2461f
......@@ -270,8 +270,7 @@ class MergeRequest < ApplicationRecord
by_commit_sha(sha),
by_squash_commit_sha(sha),
by_merge_commit_sha(sha)
],
remove_duplicates: false
]
)
end
scope :by_cherry_pick_sha, -> (sha) do
......
---
title: Remove duplicates from related_commit_sha query
merge_request: 51888
author:
type: fixed
......@@ -451,6 +451,17 @@ RSpec.describe MergeRequest, factory_default: :keep do
it { is_expected.to be_empty }
end
context 'when commit is part of the merge request and a squash commit at the same time' do
let!(:merge_request) { create(:merge_request, :with_diffs) }
let(:sha) { merge_request.commits.first.id }
before do
merge_request.update!(squash_commit_sha: sha)
end
it { is_expected.to eq([merge_request]) }
end
end
describe '.by_cherry_pick_sha' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment