Commit 052a7cc9cdc0fb14a55e7a7d71a8e4696c909658
Exists in
master
and in
4 other branches
Merge branch 'patch-2' of https://github.com/zzet/gitlabhq into zzet-patch-2
Conflicts: app/controllers/projects/merge_requests_controller.rb
Showing
1 changed file
with
9 additions
and
6 deletions
Show diff stats
app/controllers/projects/merge_requests_controller.rb
| ... | ... | @@ -157,12 +157,15 @@ class Projects::MergeRequestsController < Projects::ApplicationController |
| 157 | 157 | end |
| 158 | 158 | |
| 159 | 159 | def validates_merge_request |
| 160 | - # Show git not found page if target branch doesn't exist | |
| 161 | - return invalid_mr unless @merge_request.target_project.repository.branch_names.include?(@merge_request.target_branch) | |
| 162 | - | |
| 163 | - # Show git not found page if source branch doesn't exist | |
| 164 | - # and there is no saved commits between source & target branch | |
| 165 | - return invalid_mr if !@merge_request.source_project.repository.branch_names.include?(@merge_request.source_branch) && @merge_request.commits.blank? | |
| 160 | + # Show git not found page | |
| 161 | + # if there is no saved commits between source & target branch | |
| 162 | + if @merge_request.commits.blank? | |
| 163 | + # and if source target doesn't exist | |
| 164 | + return invalid_mr unless @merge_request.target_project.repository.branch_names.include?(@merge_request.target_branch) | |
| 165 | + | |
| 166 | + # or if source branch doesn't exist | |
| 167 | + return invalid_mr unless @merge_request.source_project.repository.branch_names.include?(@merge_request.source_branch) | |
| 168 | + end | |
| 166 | 169 | end |
| 167 | 170 | |
| 168 | 171 | def define_show_vars | ... | ... |