BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
277f311f
Commit
277f311f
authored
Jul 15, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch reference from fork repo when create merge request
parent
997a3b1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
repository.rb
app/models/repository.rb
+5
-0
create_service.rb
app/services/merge_requests/create_service.rb
+9
-0
No files found.
app/models/repository.rb
View file @
277f311f
...
...
@@ -465,6 +465,11 @@ class Repository
)
end
def
fetch_ref
(
source_path
,
source_ref
,
target_ref
)
args
=
%W(git fetch
#{
source_path
}
#{
source_ref
}
:
#{
target_ref
}
)
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
)
end
private
def
cache
...
...
app/services/merge_requests/create_service.rb
View file @
277f311f
...
...
@@ -9,6 +9,15 @@ module MergeRequests
merge_request
.
author
=
current_user
if
merge_request
.
save
# Fetch fork branch into hidden ref of target repository
if
merge_request
.
for_fork?
merge_request
.
target_project
.
repository
.
fetch_ref
(
merge_request
.
source_project
.
repository
.
path_to_repo
,
"refs/heads/
#{
merge_request
.
source_branch
}
"
,
"refs/merge-requests/
#{
merge_request
.
id
}
/head"
)
end
merge_request
.
update_attributes
(
label_ids:
label_params
)
event_service
.
open_mr
(
merge_request
,
current_user
)
notification_service
.
new_merge_request
(
merge_request
,
current_user
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment