summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-05 11:03:41 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-05 11:03:41 +0200
commitab8c71de4e57e9715d631a52d08de4e9ce87d649 (patch)
tree1813b3dc2b07c0ed991bdb65f30f6e01616ae201 /app/services
parent44ac823e59619877fb2e3fd192c35f6e827fe665 (diff)
downloadgitlab-ce-ab8c71de4e57e9715d631a52d08de4e9ce87d649.tar.gz
Fix merge request creation without branch selected
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/services')
-rw-r--r--app/services/merge_requests/build_service.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index 3ff5374b353..a9b29f9654d 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -12,8 +12,13 @@ module MergeRequests
merge_request.target_project ||= (project.forked_from_project || project)
merge_request.target_branch ||= merge_request.target_project.default_branch
- unless merge_request.target_branch && merge_request.source_branch
- return build_failed(merge_request, nil)
+ if merge_request.target_branch.blank? || merge_request.source_branch.blank?
+ message =
+ if params[:source_branch] || params[:target_branch]
+ "You must select source and target branch"
+ end
+
+ return build_failed(merge_request, message)
end
compare_result = CompareService.new.execute(