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
iv
gitlab-ce
Commits
c7e490eb
Commit
c7e490eb
authored
Aug 08, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mr-on-fork' of
https://github.com/karlhungus/gitlabhq
into karlhungus-mr-on-fork
parents
d19d094b
9a900dbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
lib/gitlab/satellite/merge_action.rb
lib/gitlab/satellite/merge_action.rb
+2
-2
spec/lib/gitlab/satellite/merge_action_spec.rb
spec/lib/gitlab/satellite/merge_action_spec.rb
+22
-9
No files found.
lib/gitlab/satellite/merge_action.rb
View file @
c7e490eb
...
...
@@ -90,9 +90,9 @@ module Gitlab
update_satellite_source_and_target!
(
merge_repo
)
if
(
merge_request
.
for_fork?
)
patch
=
merge_repo
.
git
.
format_patch
(
default_options
({
stdout:
true
}),
"origin/
#{
merge_request
.
target_branch
}
..
.
source/
#{
merge_request
.
source_branch
}
"
)
patch
=
merge_repo
.
git
.
format_patch
(
default_options
({
stdout:
true
}),
"origin/
#{
merge_request
.
target_branch
}
..source/
#{
merge_request
.
source_branch
}
"
)
else
patch
=
merge_repo
.
git
.
format_patch
(
default_options
({
stdout:
true
}),
"
#{
merge_request
.
target_branch
}
..
.
#{
merge_request
.
source_branch
}
"
)
patch
=
merge_repo
.
git
.
format_patch
(
default_options
({
stdout:
true
}),
"
#{
merge_request
.
target_branch
}
..
#{
merge_request
.
source_branch
}
"
)
end
return
patch
...
...
spec/lib/gitlab/satellite/merge_action_spec.rb
View file @
c7e490eb
...
...
@@ -51,23 +51,36 @@ describe 'Gitlab::Satellite::MergeAction' do
end
describe
'#format_patch'
do
let
(
:target_commit
)
{[
'artiom-config-examples'
,
'9edbac5ac88ffa1ec9dad0097226b51e29ebc9ac'
]}
let
(
:source_commit
)
{[
'metior'
,
'313d96e42b313a0af5ab50fa233bf43e27118b3f'
]}
def
verify_content
(
patch
)
(
patch
.
include?
source_commit
[
1
]).
should
be_true
(
patch
.
include?
'635d3e09b72232b6e92a38de6cc184147e5bcb41'
).
should
be_true
(
patch
.
include?
'2bb2dee057327c81978ed0aa99904bd7ff5e6105'
).
should
be_true
(
patch
.
include?
'2e83de1924ad3429b812d17498b009a8b924795d'
).
should
be_true
(
patch
.
include?
'ee45a49c57a362305431cbf004e4590b713c910e'
).
should
be_true
(
patch
.
include?
'a6870dd08f8f274d9a6b899f638c0c26fefaa690'
).
should
be_true
(
patch
.
include?
'e74fae147abc7d2ffbf93d363dbbe45b87751f6f'
).
should
be_false
(
patch
.
include?
'86f76b11c670425bbab465087f25172378d76147'
).
should
be_false
end
context
'on fork'
do
it
'should build a format patch'
do
merge_request_fork
.
target_branch
=
@close_commit1
[
0
]
merge_request_fork
.
source_branch
=
@close_commit2
[
0
]
merge_request_fork
.
target_branch
=
target_commit
[
0
]
merge_request_fork
.
source_branch
=
source_commit
[
0
]
patch
=
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request_fork
).
format_patch
(
patch
.
include?
"From
#{
@close_commit2
[
1
]
}
"
).
should
be_true
(
patch
.
include?
"From
#{
@close_commit1
[
1
]
}
"
).
should
be_true
verify_content
(
patch
)
end
end
context
'between branches'
do
it
'should build a format patch'
do
merge_request
.
target_branch
=
@close_commit1
[
0
]
merge_request
.
source_branch
=
@close_commit2
[
0
]
patch
=
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request
.
author
,
merge_request
).
format_patch
(
patch
.
include?
"From
#{
@close_commit2
[
1
]
}
"
).
should
be_true
(
patch
.
include?
"From
#{
@close_commit1
[
1
]
}
"
).
should
be_true
merge_request
.
target_branch
=
target_commit
[
0
]
merge_request
.
source_branch
=
source_commit
[
0
]
patch
=
Gitlab
::
Satellite
::
MergeAction
.
new
(
merge_request_fork
.
author
,
merge_request
).
format_patch
verify_content
(
patch
)
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