Commit b03d5518 authored by Robert Speicher's avatar Robert Speicher

Merge branch '3071-rebase-not-working-with-forked-projects-in-9-4-2' into 'master'

Resolve "Rebase not working with forked projects in 9.4.2"

Closes #3071

See merge request !2640
parents 19dd5af6 6e07faf1
......@@ -7,7 +7,8 @@ class RebaseWorker
current_user = User.find(current_user_id)
merge_request = MergeRequest.find(merge_request_id)
MergeRequests::RebaseService.new(merge_request.target_project, current_user)
MergeRequests::RebaseService
.new(merge_request.source_project, current_user)
.execute(merge_request)
end
end
---
title: Fix rebase from fork when upstream has protected branches
merge_request:
author:
require 'spec_helper'
describe RebaseWorker, '#perform' do
context 'when rebasing an MR from a fork where upstream has protected branches' do
let(:upstream_project) { create(:project, :repository) }
let(:fork_project) { create(:project, :repository) }
let(:merge_request) do
create(:merge_request,
source_project: fork_project,
source_branch: 'feature_conflict',
target_project: upstream_project,
target_branch: 'master')
end
before do
create(:forked_project_link, forked_to_project: fork_project, forked_from_project: upstream_project)
end
it 'sets the correct project for running hooks' do
expect(MergeRequests::RebaseService)
.to receive(:new).with(fork_project, merge_request.author).and_call_original
subject.perform(merge_request, merge_request.author)
end
end
end
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