Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
app/models/repository.rb
app/models/repository.rb
+5
-0
app/services/merge_requests/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
...
@@ -465,6 +465,11 @@ class Repository
)
)
end
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
private
def
cache
def
cache
...
...
app/services/merge_requests/create_service.rb
View file @
277f311f
...
@@ -9,6 +9,15 @@ module MergeRequests
...
@@ -9,6 +9,15 @@ module MergeRequests
merge_request
.
author
=
current_user
merge_request
.
author
=
current_user
if
merge_request
.
save
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
)
merge_request
.
update_attributes
(
label_ids:
label_params
)
event_service
.
open_mr
(
merge_request
,
current_user
)
event_service
.
open_mr
(
merge_request
,
current_user
)
notification_service
.
new_merge_request
(
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