Skip to content
Snippets Groups Projects
Commit ae86a1b9 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

Just trust set_commit_variables to set everything!

Removing those weird setup in assign_change_commit_vars
fixed all the failures in the tests. I still cannot say
why but clearly we need to have better names. It's so
confusing right now. We should seriously stop fiddling
those instance variables.
parent 5e12b3d8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -4,11 +4,9 @@ module CreatesCommit
def create_commit(service, success_path:, failure_path:, failure_view: nil, success_notice: nil)
set_commit_variables
 
source_branch = @ref if
@ref && @mr_target_project.repository.branch_exists?(@ref)
commit_params = @commit_params.merge(
source_project: @mr_target_project,
source_branch: source_branch,
source_branch: @mr_target_branch,
target_branch: @mr_source_branch
)
 
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ class Projects::CommitController < Projects::ApplicationController
end
 
def revert
assign_change_commit_vars(@commit.revert_branch_name)
assign_change_commit_vars
 
return render_404 if @target_branch.blank?
 
Loading
Loading
@@ -49,7 +49,7 @@ class Projects::CommitController < Projects::ApplicationController
end
 
def cherry_pick
assign_change_commit_vars(@commit.cherry_pick_branch_name)
assign_change_commit_vars
 
return render_404 if @target_branch.blank?
 
Loading
Loading
@@ -110,11 +110,9 @@ class Projects::CommitController < Projects::ApplicationController
@ci_pipelines = project.pipelines.where(sha: commit.sha)
end
 
def assign_change_commit_vars(mr_source_branch)
def assign_change_commit_vars
@commit = project.commit(params[:id])
@target_branch = params[:target_branch]
@mr_source_branch = mr_source_branch
@mr_target_branch = @target_branch
@commit_params = {
commit: @commit,
create_merge_request: params[:create_merge_request].present? || different_project?
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ module Commits
 
def execute
@source_project = params[:source_project] || @project
@source_branch = params[:source_branch]
@target_branch = params[:target_branch]
@commit = params[:commit]
@create_merge_request = params[:create_merge_request].present?
Loading
Loading
@@ -38,7 +39,7 @@ module Commits
into,
tree_id,
source_project: @source_project,
source_branch_name: @target_branch)
source_branch_name: @source_branch)
 
success
else
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment