Commit 45b18365 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix an issue with MR unavailable if remove source branch

parent ac3c23f9
...@@ -34,11 +34,14 @@ class MergeRequestsController < ApplicationController ...@@ -34,11 +34,14 @@ class MergeRequestsController < ApplicationController
end end
def show def show
unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch) && # Show git not found page if target branch doesnt exist
@project.repo.heads.map(&:name).include?(@merge_request.source_branch) return git_not_found! unless @project.repo.heads.map(&:name).include?(@merge_request.target_branch)
git_not_found! and return
end # Show git not found page if source branch doesnt exist
# and there is no saved commits between source & target branch
return git_not_found! if !@project.repo.heads.map(&:name).include?(@merge_request.source_branch) && @merge_request.commits.blank?
# Build a note object for comment form
@note = @project.notes.new(:noteable => @merge_request) @note = @project.notes.new(:noteable => @merge_request)
# Get commits from repository # Get commits from repository
......
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