summaryrefslogtreecommitdiff
path: root/app/controllers/projects/branches_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r--app/controllers/projects/branches_controller.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 32b7f3207ef..00c7fd9d000 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -16,7 +16,7 @@ class Projects::BranchesController < Projects::ApplicationController
respond_to do |format|
format.html do
@sort = params[:sort].presence || sort_value_recently_updated
- @mode = params[:state].presence || 'overview'
+ @mode = params[:state].presence || "overview"
@overview_max_branches = 5
# Fetch branches for the specified mode
@@ -27,11 +27,11 @@ class Projects::BranchesController < Projects::ApplicationController
# n+1: https://gitlab.com/gitlab-org/gitaly/issues/992
Gitlab::GitalyClient.allow_n_plus_1_calls do
- @max_commits = @branches.reduce(0) do |memo, branch|
+ @max_commits = @branches.reduce(0) { |memo, branch|
diverging_commit_counts = repository.diverging_commit_counts(branch)
[memo, diverging_commit_counts.values_at(:behind, :ahead, :distance)]
.flatten.compact.max
- end
+ }
end
# https://gitlab.com/gitlab-org/gitlab-ce/issues/48097
@@ -59,7 +59,7 @@ class Projects::BranchesController < Projects::ApplicationController
redirect_to_autodeploy = project.empty_repo? && project.deployment_platform.present?
result = CreateBranchService.new(project, current_user)
- .execute(branch_name, ref)
+ .execute(branch_name, ref)
success = (result[:status] == :success)
@@ -79,13 +79,13 @@ class Projects::BranchesController < Projects::ApplicationController
end
else
@error = result[:message]
- render action: 'new'
+ render action: "new"
end
end
format.json do
if success
- render json: { name: branch_name, url: project_tree_url(@project, branch_name) }
+ render json: {name: branch_name, url: project_tree_url(@project, branch_name)}
else
render json: result[:messsage], status: :unprocessable_entity
end
@@ -107,7 +107,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
format.js { head result[:return_code] }
- format.json { render json: { message: result[:message] }, status: result[:return_code] }
+ format.json { render json: {message: result[:message]}, status: result[:return_code] }
end
end
@@ -115,7 +115,7 @@ class Projects::BranchesController < Projects::ApplicationController
DeleteMergedBranchesService.new(@project, current_user).async_execute
redirect_to project_branches_path(@project),
- notice: 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.'
+ notice: "Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes."
end
private
@@ -125,7 +125,7 @@ class Projects::BranchesController < Projects::ApplicationController
ref_escaped = sanitize(strip_tags(params[:ref]))
Addressable::URI.unescape(ref_escaped)
else
- @project.default_branch || 'master'
+ @project.default_branch || "master"
end
end
@@ -133,22 +133,22 @@ class Projects::BranchesController < Projects::ApplicationController
project_new_blob_path(
project,
branch_name,
- file_name: '.gitlab-ci.yml',
- commit_message: 'Set up auto deploy',
+ file_name: ".gitlab-ci.yml",
+ commit_message: "Set up auto deploy",
target_branch: branch_name,
- context: 'autodeploy'
+ context: "autodeploy"
)
end
def redirect_for_legacy_index_sort_or_search
# Normalize a legacy URL with redirect
if request.format != :json && !params[:state].presence && [:sort, :search, :page].any? { |key| params[key].presence }
- redirect_to project_branches_filtered_path(@project, state: 'all'), notice: 'Update your bookmarked URLs as filtered/sorted branches URL has been changed.'
+ redirect_to project_branches_filtered_path(@project, state: "all"), notice: "Update your bookmarked URLs as filtered/sorted branches URL has been changed."
end
end
def fetch_branches_by_mode
- if @mode == 'overview'
+ if @mode == "overview"
# overview mode
@active_branches, @stale_branches = BranchesFinder.new(@repository, sort: sort_value_recently_updated).execute.partition(&:active?)
# Here we get one more branch to indicate if there are more data we're not showing