diff options
author | Izaak Alpert <ialpert@blackberry.com> | 2013-07-30 16:09:40 -0400 |
---|---|---|
committer | Izaak Alpert <ialpert@blackberry.com> | 2013-07-30 16:13:01 -0400 |
commit | 7856fba3621c0c3437f3bd208de0fdab43f0ab9d (patch) | |
tree | 17832ee50641453f9bf8093447811da8a3b8d723 | |
parent | 4d373005968b8269a8d2fe56b7776820396127a4 (diff) | |
download | gitlab-ce-7856fba3621c0c3437f3bd208de0fdab43f0ab9d.tar.gz |
Updated format_patch to use '..' rather than '...'
Was incorrectly including commits reachable from rev2.
Change-Id: I3560e5d5ce474ba3d374f29ae16190b1f74989be
-rw-r--r-- | lib/gitlab/satellite/merge_action.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/satellite/merge_action_spec.rb | 31 |
2 files changed, 26 insertions, 11 deletions
diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 6f402e80a63..003141a24b4 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -89,13 +89,15 @@ module Gitlab prepare_satellite!(merge_repo) 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 end rescue Grit::Git::CommandFailed => ex + puts ex + ex.backtrace.each {|l|puts l} handle_exception(ex) end diff --git a/spec/lib/gitlab/satellite/merge_action_spec.rb b/spec/lib/gitlab/satellite/merge_action_spec.rb index 98e475e715d..3be14383e06 100644 --- a/spec/lib/gitlab/satellite/merge_action_spec.rb +++ b/spec/lib/gitlab/satellite/merge_action_spec.rb @@ -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 |