Commit 052a7cc9 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'patch-2' of https://github.com/zzet/gitlabhq into zzet-patch-2

Conflicts:
	app/controllers/projects/merge_requests_controller.rb
parents 9bb1e15c fb8a3e31
...@@ -157,12 +157,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -157,12 +157,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def validates_merge_request def validates_merge_request
# Show git not found page if target branch doesn't exist # Show git not found page
return invalid_mr unless @merge_request.target_project.repository.branch_names.include?(@merge_request.target_branch) # if there is no saved commits between source & target branch
if @merge_request.commits.blank?
# Show git not found page if source branch doesn't exist # and if source target doesn't exist
# and there is no saved commits between source & target branch return invalid_mr unless @merge_request.target_project.repository.branch_names.include?(@merge_request.target_branch)
return invalid_mr if !@merge_request.source_project.repository.branch_names.include?(@merge_request.source_branch) && @merge_request.commits.blank?
# or if source branch doesn't exist
return invalid_mr unless @merge_request.source_project.repository.branch_names.include?(@merge_request.source_branch)
end
end end
def define_show_vars def define_show_vars
......
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