Commit 0ece3d65 authored by Douwe Maan's avatar Douwe Maan Committed by Robert Speicher

Merge branch 'fix-merge-request-that-removes-submodule' into 'master'

Fix 500 error when creating a merge request that removes a submodule

Fixes #3476

See merge request !1989
parent 38397062
...@@ -6,6 +6,7 @@ v 8.2.3 ...@@ -6,6 +6,7 @@ v 8.2.3
- Update documentation for "Guest" permissions - Update documentation for "Guest" permissions
- Properly convert Emoji-only comments into Award Emojis - Properly convert Emoji-only comments into Award Emojis
- Webhook payload has an added, modified and removed properties for each commit - Webhook payload has an added, modified and removed properties for each commit
- Fix 500 error when creating a merge request that removes a submodule
v 8.2.2 v 8.2.2
- Fix 404 in redirection after removing a project (Stan Hu) - Fix 404 in redirection after removing a project (Stan Hu)
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
.diff-header{id: "file-path-#{hexdigest(diff_file.file_path)}"} .diff-header{id: "file-path-#{hexdigest(diff_file.file_path)}"}
- if diff_file.diff.submodule? - if diff_file.diff.submodule?
%span %span
- submodule_item = project.repository.blob_at(@commit.id, diff_file.file_path) = icon('archive fw')
= submodule_link(submodule_item, @commit.id, project.repository) %strong
= submodule_link(blob, @commit.id, project.repository)
- else - else
%span %span
- if diff_file.deleted_file - if diff_file.deleted_file
......
...@@ -95,6 +95,26 @@ describe Projects::CommitController do ...@@ -95,6 +95,26 @@ describe Projects::CommitController do
expect(response.body).to match(/^diff --git/) expect(response.body).to match(/^diff --git/)
end end
end end
context 'commit that removes a submodule' do
render_views
let(:fork_project) { create(:forked_project_with_submodules) }
let(:commit) { fork_project.commit('remove-submodule') }
before do
fork_project.team << [user, :master]
end
it 'renders it' do
get(:show,
namespace_id: fork_project.namespace.to_param,
project_id: fork_project.to_param,
id: commit.id)
expect(response).to be_success
end
end
end end
describe "#branches" do describe "#branches" do
......
...@@ -10,6 +10,30 @@ describe Projects::MergeRequestsController do ...@@ -10,6 +10,30 @@ describe Projects::MergeRequestsController do
project.team << [user, :master] project.team << [user, :master]
end end
describe '#new' do
context 'merge request that removes a submodule' do
render_views
let(:fork_project) { create(:forked_project_with_submodules) }
before do
fork_project.team << [user, :master]
end
it 'renders it' do
get :new,
namespace_id: fork_project.namespace.to_param,
project_id: fork_project.to_param,
merge_request: {
source_branch: 'remove-submodule',
target_branch: 'master'
}
expect(response).to be_success
end
end
end
describe "#show" do describe "#show" do
shared_examples "export merge as" do |format| shared_examples "export merge as" do |format|
it "should generally work" do it "should generally work" do
......
...@@ -21,7 +21,8 @@ module TestEnv ...@@ -21,7 +21,8 @@ module TestEnv
# We currently only need a subset of the branches # We currently only need a subset of the branches
FORKED_BRANCH_SHA = { FORKED_BRANCH_SHA = {
'add-submodule-version-bump' => '3f547c08', 'add-submodule-version-bump' => '3f547c08',
'master' => '5937ac0' 'master' => '5937ac0',
'remove-submodule' => '2a33e0c0'
} }
# Test environment # Test environment
......
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