Commit c7e490ebd5ab69fe043cd39145bd6ef3850a6921
Exists in
master
and in
4 other branches
Merge branch 'mr-on-fork' of https://github.com/karlhungus/gitlabhq into karlhungus-mr-on-fork
Showing
2 changed files
with
24 additions
and
11 deletions
Show diff stats
lib/gitlab/satellite/merge_action.rb
| @@ -90,9 +90,9 @@ module Gitlab | @@ -90,9 +90,9 @@ module Gitlab | ||
| 90 | update_satellite_source_and_target!(merge_repo) | 90 | update_satellite_source_and_target!(merge_repo) |
| 91 | 91 | ||
| 92 | if (merge_request.for_fork?) | 92 | if (merge_request.for_fork?) |
| 93 | - patch = merge_repo.git.format_patch(default_options({stdout: true}), "origin/#{merge_request.target_branch}...source/#{merge_request.source_branch}") | 93 | + patch = merge_repo.git.format_patch(default_options({stdout: true}), "origin/#{merge_request.target_branch}..source/#{merge_request.source_branch}") |
| 94 | else | 94 | else |
| 95 | - patch = merge_repo.git.format_patch(default_options({stdout: true}), "#{merge_request.target_branch}...#{merge_request.source_branch}") | 95 | + patch = merge_repo.git.format_patch(default_options({stdout: true}), "#{merge_request.target_branch}..#{merge_request.source_branch}") |
| 96 | end | 96 | end |
| 97 | 97 | ||
| 98 | return patch | 98 | return patch |
spec/lib/gitlab/satellite/merge_action_spec.rb
| @@ -51,23 +51,36 @@ describe 'Gitlab::Satellite::MergeAction' do | @@ -51,23 +51,36 @@ describe 'Gitlab::Satellite::MergeAction' do | ||
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | describe '#format_patch' do | 53 | describe '#format_patch' do |
| 54 | + let(:target_commit) {['artiom-config-examples','9edbac5ac88ffa1ec9dad0097226b51e29ebc9ac']} | ||
| 55 | + let(:source_commit) {['metior', '313d96e42b313a0af5ab50fa233bf43e27118b3f']} | ||
| 56 | + | ||
| 57 | + def verify_content(patch) | ||
| 58 | + (patch.include? source_commit[1]).should be_true | ||
| 59 | + (patch.include? '635d3e09b72232b6e92a38de6cc184147e5bcb41').should be_true | ||
| 60 | + (patch.include? '2bb2dee057327c81978ed0aa99904bd7ff5e6105').should be_true | ||
| 61 | + (patch.include? '2e83de1924ad3429b812d17498b009a8b924795d').should be_true | ||
| 62 | + (patch.include? 'ee45a49c57a362305431cbf004e4590b713c910e').should be_true | ||
| 63 | + (patch.include? 'a6870dd08f8f274d9a6b899f638c0c26fefaa690').should be_true | ||
| 64 | + | ||
| 65 | + (patch.include? 'e74fae147abc7d2ffbf93d363dbbe45b87751f6f').should be_false | ||
| 66 | + (patch.include? '86f76b11c670425bbab465087f25172378d76147').should be_false | ||
| 67 | + end | ||
| 68 | + | ||
| 54 | context 'on fork' do | 69 | context 'on fork' do |
| 55 | it 'should build a format patch' do | 70 | it 'should build a format patch' do |
| 56 | - merge_request_fork.target_branch = @close_commit1[0] | ||
| 57 | - merge_request_fork.source_branch = @close_commit2[0] | 71 | + merge_request_fork.target_branch = target_commit[0] |
| 72 | + merge_request_fork.source_branch = source_commit[0] | ||
| 58 | patch = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).format_patch | 73 | patch = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request_fork).format_patch |
| 59 | - (patch.include? "From #{@close_commit2[1]}").should be_true | ||
| 60 | - (patch.include? "From #{@close_commit1[1]}").should be_true | 74 | + verify_content(patch) |
| 61 | end | 75 | end |
| 62 | end | 76 | end |
| 63 | 77 | ||
| 64 | context 'between branches' do | 78 | context 'between branches' do |
| 65 | it 'should build a format patch' do | 79 | it 'should build a format patch' do |
| 66 | - merge_request.target_branch = @close_commit1[0] | ||
| 67 | - merge_request.source_branch = @close_commit2[0] | ||
| 68 | - patch = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).format_patch | ||
| 69 | - (patch.include? "From #{@close_commit2[1]}").should be_true | ||
| 70 | - (patch.include? "From #{@close_commit1[1]}").should be_true | 80 | + merge_request.target_branch = target_commit[0] |
| 81 | + merge_request.source_branch = source_commit[0] | ||
| 82 | + patch = Gitlab::Satellite::MergeAction.new(merge_request_fork.author, merge_request).format_patch | ||
| 83 | + verify_content(patch) | ||
| 71 | end | 84 | end |
| 72 | end | 85 | end |
| 73 | end | 86 | end |