Remove @commit in compare and MR controllers
This commit is contained in:
parent
7c479d88a9
commit
bc4fec1fcb
|
@ -51,12 +51,9 @@ class Projects::CompareController < Projects::ApplicationController
|
|||
|
||||
if @compare
|
||||
@commits = @compare.commits
|
||||
@start_commit = @compare.start_commit
|
||||
@commit = @compare.commit
|
||||
|
||||
@diffs = @compare.diffs(diff_options)
|
||||
|
||||
environment_params = @repository.branch_exists?(@head_ref) ? { ref: @head_ref } : { commit: @commit }
|
||||
environment_params = @repository.branch_exists?(@head_ref) ? { ref: @head_ref } : { commit: @compare.commit }
|
||||
@environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last
|
||||
|
||||
@diff_notes_disabled = true
|
||||
|
|
|
@ -14,7 +14,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
|||
]
|
||||
before_action :validates_merge_request, only: [:show, :diffs, :commits, :pipelines]
|
||||
before_action :define_show_vars, only: [:diffs, :commits, :conflicts, :conflict_for_path, :builds, :pipelines]
|
||||
before_action :define_commit_vars, only: [:diffs]
|
||||
before_action :ensure_ref_fetched, only: [:show, :diffs, :commits, :builds, :conflicts, :conflict_for_path, :pipelines]
|
||||
before_action :close_merge_request_without_source_project, only: [:show, :diffs, :commits, :builds, :pipelines]
|
||||
before_action :check_if_can_be_merged, only: :show
|
||||
|
@ -130,8 +129,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
|||
@diff_notes_disabled = true
|
||||
end
|
||||
|
||||
define_commit_vars
|
||||
|
||||
render_diff_for_path(@diffs)
|
||||
end
|
||||
|
||||
|
@ -500,10 +497,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
|||
@notes = prepare_notes_for_rendering(@discussions.flat_map(&:notes))
|
||||
end
|
||||
|
||||
def define_commit_vars
|
||||
@commit = @merge_request.diff_head_commit
|
||||
end
|
||||
|
||||
def define_diff_vars
|
||||
@merge_request_diff =
|
||||
if params[:diff_id]
|
||||
|
|
|
@ -159,6 +159,9 @@ class MergeRequestDiff < ActiveRecord::Base
|
|||
# It is not good enough for highlighting diffs, so we can't simply pass
|
||||
# these as `diff_refs.`
|
||||
def fallback_diff_refs
|
||||
real_refs = diff_refs
|
||||
return real_refs if real_refs
|
||||
|
||||
likely_base_commit_sha = (first_commit&.parent || first_commit)&.sha
|
||||
|
||||
Gitlab::Diff::DiffRefs.new(
|
||||
|
|
Loading…
Reference in New Issue