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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c87f0622
Commit
c87f0622
authored
Nov 02, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rebase for forks
parent
1da14e0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
app/services/merge_requests/rebase_service.rb
app/services/merge_requests/rebase_service.rb
+1
-1
spec/services/merge_requests/rebase_service_spec.rb
spec/services/merge_requests/rebase_service_spec.rb
+27
-0
No files found.
app/services/merge_requests/rebase_service.rb
View file @
c87f0622
...
@@ -24,7 +24,7 @@ module MergeRequests
...
@@ -24,7 +24,7 @@ module MergeRequests
)
)
run_git_command
(
run_git_command
(
%W(
rebase
#{
merge_request
.
target_branch
}
)
,
%W(
pull --rebase
#{
target_project
.
repository
.
path_to_repo
}
#{
merge_request
.
target_branch
}
)
,
tree_path
,
tree_path
,
git_env
.
merge
(
'GIT_COMMITTER_NAME'
=>
current_user
.
name
,
git_env
.
merge
(
'GIT_COMMITTER_NAME'
=>
current_user
.
name
,
'GIT_COMMITTER_EMAIL'
=>
current_user
.
email
),
'GIT_COMMITTER_EMAIL'
=>
current_user
.
email
),
...
...
spec/services/merge_requests/rebase_service_spec.rb
View file @
c87f0622
require
'spec_helper'
require
'spec_helper'
describe
MergeRequests
::
RebaseService
do
describe
MergeRequests
::
RebaseService
do
include
ProjectForksHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
do
let
(
:merge_request
)
do
create
(
:merge_request
,
create
(
:merge_request
,
...
@@ -104,6 +106,31 @@ describe MergeRequests::RebaseService do
...
@@ -104,6 +106,31 @@ describe MergeRequests::RebaseService do
service
.
execute
(
merge_request
)
service
.
execute
(
merge_request
)
end
end
end
end
context
'fork'
do
let
(
:forked_project
)
do
fork_project
(
project
,
user
,
repository:
true
)
end
let
(
:merge_request_from_fork
)
do
forked_project
.
repository
.
create_file
(
user
,
'new-file-to-target'
,
''
,
message:
'Add new file to target'
,
branch_name:
'master'
)
create
(
:merge_request
,
source_branch:
'master'
,
source_project:
forked_project
,
target_branch:
'master'
,
target_project:
project
)
end
it
'rebases source branch'
do
parent_sha
=
forked_project
.
repository
.
commit
(
merge_request_from_fork
.
source_branch
).
parents
.
first
.
sha
target_branch_sha
=
project
.
repository
.
commit
(
merge_request_from_fork
.
target_branch
).
sha
expect
(
parent_sha
).
to
eq
(
target_branch_sha
)
end
end
end
end
end
end
end
end
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