summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
authorJacob Carlborg <jacob.carlborg@tretti.se>2013-11-28 09:45:35 +0100
committerJacob Carlborg <doob@me.com>2014-02-24 22:06:25 +0100
commit9439cb55260185b4a456982613f657f3c1b11915 (patch)
treecff49cb624021d9508b7dc390ad0573e46225c21 /app/controllers/projects
parent504777ec20f006fd92cc948c03d35df3e1df4d3b (diff)
downloadgitlab-ce-9439cb55260185b4a456982613f657f3c1b11915.tar.gz
By default, target original repository if fork when creating new MR.
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/merge_requests_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 2b410c5a610..4e07a7af386 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -60,7 +60,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def new
@merge_request = MergeRequest.new(params[:merge_request])
@merge_request.source_project = @project unless @merge_request.source_project
- @merge_request.target_project = @project unless @merge_request.target_project
+ @merge_request.target_project ||= (@project.forked_from_project || @project)
+ @target_branches = @merge_request.target_project.nil? ? [] : @merge_request.target_project.repository.branch_names
+
+ @merge_request.target_branch ||= @merge_request.target_project.default_branch
+
@source_project = @merge_request.source_project
@merge_request
end