diff options
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 2b0c2ca97c0..231f2df8201 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -10,6 +10,7 @@ class Projects::CompareController < Projects::ApplicationController before_action :authorize_download_code! before_action :define_ref_vars, only: [:index, :show, :diff_for_path] before_action :define_diff_vars, only: [:show, :diff_for_path] + before_action :prepare_commits, only: [:diff_for_path] before_action :merge_request, only: [:index, :show] def index @@ -53,7 +54,7 @@ class Projects::CompareController < Projects::ApplicationController .execute(@project, @start_ref) if @compare - @commits = prepare_commits_for_rendering(@compare.commits) + @commits = @compare.commits @diffs = @compare.diffs(diff_options) environment_params = @repository.branch_exists?(@head_ref) ? { ref: @head_ref } : { commit: @compare.commit } @@ -63,6 +64,10 @@ class Projects::CompareController < Projects::ApplicationController end end + def prepare_commits + @commits = prepare_commits_for_rendering(@commits) + end + def merge_request @merge_request ||= MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened .find_by(source_project: @project, source_branch: @head_ref, target_branch: @start_ref) |