Fix fork MRs importing issue
This commit is contained in:
parent
646aae3e4f
commit
fb9bd552c9
|
@ -133,5 +133,7 @@ methods:
|
|||
- :utf8_diff
|
||||
merge_requests:
|
||||
- :diff_head_sha
|
||||
- :source_branch_sha
|
||||
- :target_branch_sha
|
||||
project:
|
||||
- :description_html
|
||||
|
|
|
@ -30,7 +30,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def branch_exists?(branch_name)
|
||||
@project.repository.branch_exists?(branch_name)
|
||||
@project.repository.raw.branch_exists?(branch_name)
|
||||
end
|
||||
|
||||
def fork_merge_request?
|
||||
|
|
|
@ -2522,7 +2522,7 @@
|
|||
"id": 27,
|
||||
"target_branch": "feature",
|
||||
"source_branch": "feature_conflict",
|
||||
"source_project_id": 5,
|
||||
"source_project_id": 999,
|
||||
"author_id": 1,
|
||||
"assignee_id": null,
|
||||
"title": "MR1",
|
||||
|
@ -2536,6 +2536,9 @@
|
|||
"position": 0,
|
||||
"updated_by_id": null,
|
||||
"merge_error": null,
|
||||
"diff_head_sha": "HEAD",
|
||||
"source_branch_sha": "ABCD",
|
||||
"target_branch_sha": "DCBA",
|
||||
"merge_params": {
|
||||
"force_remove_source_branch": null
|
||||
},
|
||||
|
|
|
@ -10,6 +10,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
|
|||
@shared = Gitlab::ImportExport::Shared.new(relative_path: "", project_path: 'path')
|
||||
allow(@shared).to receive(:export_path).and_return('spec/lib/gitlab/import_export/')
|
||||
@project = create(:project, :builds_disabled, :issues_disabled, name: 'project', path: 'project')
|
||||
|
||||
allow(@project.repository).to receive(:fetch_ref).and_return(true)
|
||||
expect(@project.repository).to receive(:create_branch).with('feature', 'DCBA')
|
||||
|
||||
project_tree_restorer = described_class.new(user: @user, shared: @shared, project: @project)
|
||||
@restored_project_json = project_tree_restorer.restore
|
||||
end
|
||||
|
|
|
@ -11,6 +11,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
before do
|
||||
project.team << [user, :master]
|
||||
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
|
||||
allow_any_instance_of(MergeRequest).to receive(:source_branch_sha).and_return('ABCD')
|
||||
allow_any_instance_of(MergeRequest).to receive(:target_branch_sha).and_return('DCBA')
|
||||
end
|
||||
|
||||
after do
|
||||
|
@ -43,6 +45,14 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
|
|||
expect(saved_project_json['merge_requests'].first['milestone']).not_to be_empty
|
||||
end
|
||||
|
||||
it 'has merge request\'s source branch SHA' do
|
||||
expect(saved_project_json['merge_requests'].first['source_branch_sha']).to eq('ABCD')
|
||||
end
|
||||
|
||||
it 'has merge request\'s target branch SHA' do
|
||||
expect(saved_project_json['merge_requests'].first['target_branch_sha']).to eq('DCBA')
|
||||
end
|
||||
|
||||
it 'has events' do
|
||||
expect(saved_project_json['merge_requests'].first['milestone']['events']).not_to be_empty
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue