diff --git a/app/views/projects/merge_requests/update_branches.js.haml b/app/views/projects/merge_requests/update_branches.js.haml index 7324aa89a5e..db25ae3b918 100644 --- a/app/views/projects/merge_requests/update_branches.js.haml +++ b/app/views/projects/merge_requests/update_branches.js.haml @@ -1,4 +1,5 @@ :plain $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}"); $(".target_branch").trigger("liszt:updated"); - $(".mr_target_commit").html(""); \ No newline at end of file + $(".mr_target_commit").html(""); + $(".target_branch").trigger("change"); \ No newline at end of file diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 3610a18bc91..6f402e80a63 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -74,9 +74,7 @@ module Gitlab #this method doesn't take default options diffs = merge_repo.diff(common_commit, "source/#{merge_request.source_branch}") else - common_commit = merge_repo.git.native(:merge_base, default_options, ["#{merge_request.target_branch}", "#{merge_request.source_branch}"]).strip - #this method doesn't take default options - diffs = merge_repo.diff(common_commit, "#{merge_request.source_branch}") + raise "Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]" end diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) } return diffs @@ -109,7 +107,7 @@ module Gitlab if (merge_request.for_fork?) commits = merge_repo.commits_between("origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}") else - commits = merge_repo.commits_between("#{merge_request.target_branch}", "#{merge_request.source_branch}") + raise "Attempt to determine commits between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]" end commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } return commits diff --git a/spec/lib/gitlab/satellite/merge_action_spec.rb b/spec/lib/gitlab/satellite/merge_action_spec.rb index 2478efe8493..98e475e715d 100644 --- a/spec/lib/gitlab/satellite/merge_action_spec.rb +++ b/spec/lib/gitlab/satellite/merge_action_spec.rb @@ -38,16 +38,14 @@ describe 'Gitlab::Satellite::MergeAction' do end context 'between branches' do - it 'should get proper commits between' do + it 'should raise exception -- not expected to be used by non forks' do merge_request.target_branch = @one_after_stable[0] merge_request.source_branch = @master[0] - commits = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between - verify_commits(commits, @one_after_stable[1], @master[1]) + expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error merge_request.target_branch = @wiki_branch[0] merge_request.source_branch = @master[0] - commits = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between - verify_commits(commits, @wiki_branch[1], @master[1]) + expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error end end end @@ -104,13 +102,7 @@ describe 'Gitlab::Satellite::MergeAction' do it 'should get proper diffs' do merge_request.target_branch = @close_commit1[0] merge_request.source_branch = @master[0] - diffs = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite - - merge_request.target_branch = @close_commit1[0] - merge_request.source_branch = @master[0] - diff = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diff_in_satellite - - is_a_matching_diff(diff, diffs) + expect{Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite}.to raise_error end end end