Commit c648bc66 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'ee-18040-line-breaks-around-conditional-blocks' into 'master'

[EE] Adds Rubocop rule for line break around conditionals

See merge request gitlab-org/gitlab-ee!3919
parents ba55d2dd 524514f3
...@@ -65,6 +65,7 @@ class Admin::RunnersController < Admin::ApplicationController ...@@ -65,6 +65,7 @@ class Admin::RunnersController < Admin::ApplicationController
else else
Project.all Project.all
end end
@projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any? @projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any?
@projects = @projects.page(params[:page]).per(30) @projects = @projects.page(params[:page]).per(30)
end end
......
...@@ -8,6 +8,7 @@ module GroupTree ...@@ -8,6 +8,7 @@ module GroupTree
# Only show root groups if no parent-id is given # Only show root groups if no parent-id is given
groups.where(parent_id: params[:parent_id]) groups.where(parent_id: params[:parent_id])
end end
@groups = @groups.with_selects_for_list(archived: params[:archived]) @groups = @groups.with_selects_for_list(archived: params[:archived])
.sort(@sort = params[:sort]) .sort(@sort = params[:sort])
.page(params[:page]) .page(params[:page])
......
...@@ -32,6 +32,7 @@ module RoutableActions ...@@ -32,6 +32,7 @@ module RoutableActions
if canonical_path.casecmp(requested_full_path) != 0 if canonical_path.casecmp(requested_full_path) != 0
flash[:notice] = "#{routable.class.to_s.titleize} '#{requested_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." flash[:notice] = "#{routable.class.to_s.titleize} '#{requested_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path."
end end
redirect_to build_canonical_path(routable) redirect_to build_canonical_path(routable)
end end
end end
......
...@@ -12,6 +12,7 @@ class MetricsController < ActionController::Base ...@@ -12,6 +12,7 @@ class MetricsController < ActionController::Base
) )
"# Metrics are disabled, see: #{help_page}\n" "# Metrics are disabled, see: #{help_page}\n"
end end
render text: response, content_type: 'text/plain; version=0.0.4' render text: response, content_type: 'text/plain; version=0.0.4'
end end
......
...@@ -86,6 +86,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -86,6 +86,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
if ticket if ticket
handle_service_ticket oauth['provider'], ticket handle_service_ticket oauth['provider'], ticket
end end
handle_omniauth handle_omniauth
end end
...@@ -138,6 +139,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -138,6 +139,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Only allow properly saved users to login. # Only allow properly saved users to login.
if @user.persisted? && @user.valid? if @user.persisted? && @user.valid?
log_audit_event(@user, with: oauth['provider']) log_audit_event(@user, with: oauth['provider'])
if @user.two_factor_enabled? if @user.two_factor_enabled?
params[:remember_me] = '1' if remember_me? params[:remember_me] = '1' if remember_me?
prompt_for_two_factor(@user) prompt_for_two_factor(@user)
......
...@@ -150,6 +150,7 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -150,6 +150,7 @@ class Projects::BlobController < Projects::ApplicationController
if params[:file].present? if params[:file].present?
params[:file_name] = params[:file].original_filename params[:file_name] = params[:file].original_filename
end end
File.join(@path, params[:file_name]) File.join(@path, params[:file_name])
elsif params[:file_path].present? elsif params[:file_path].present?
params[:file_path] params[:file_path]
......
...@@ -21,6 +21,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -21,6 +21,7 @@ class Projects::HooksController < Projects::ApplicationController
@hooks = @project.hooks.select(&:persisted?) @hooks = @project.hooks.select(&:persisted?)
flash[:alert] = @hook.errors.full_messages.join.html_safe flash[:alert] = @hook.errors.full_messages.join.html_safe
end end
redirect_to project_settings_integrations_path(@project) redirect_to project_settings_integrations_path(@project)
end end
......
...@@ -50,6 +50,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap ...@@ -50,6 +50,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
else else
[] []
end end
@diff_notes_disabled = true @diff_notes_disabled = true
@environment = @merge_request.environments_for(current_user).last @environment = @merge_request.environments_for(current_user).last
......
...@@ -206,6 +206,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -206,6 +206,7 @@ class ProjectsController < Projects::ApplicationController
else else
flash[:alert] = _("Project export could not be deleted.") flash[:alert] = _("Project export could not be deleted.")
end end
redirect_to(edit_project_path(@project)) redirect_to(edit_project_path(@project))
end end
......
...@@ -29,6 +29,7 @@ class SessionsController < Devise::SessionsController ...@@ -29,6 +29,7 @@ class SessionsController < Devise::SessionsController
resource.update_attributes(reset_password_token: nil, resource.update_attributes(reset_password_token: nil,
reset_password_sent_at: nil) reset_password_sent_at: nil)
end end
# hide the signed-in notification # hide the signed-in notification
flash[:notice] = nil flash[:notice] = nil
log_audit_event(current_user, resource, with: authentication_method) log_audit_event(current_user, resource, with: authentication_method)
......
...@@ -63,6 +63,7 @@ class GroupDescendantsFinder ...@@ -63,6 +63,7 @@ class GroupDescendantsFinder
groups_table = Group.arel_table groups_table = Group.arel_table
visible_to_user = groups_table[:visibility_level] visible_to_user = groups_table[:visibility_level]
.in(Gitlab::VisibilityLevel.levels_for_user(current_user)) .in(Gitlab::VisibilityLevel.levels_for_user(current_user))
if current_user if current_user
authorized_groups = GroupsFinder.new(current_user, authorized_groups = GroupsFinder.new(current_user,
all_available: false) all_available: false)
...@@ -115,6 +116,7 @@ class GroupDescendantsFinder ...@@ -115,6 +116,7 @@ class GroupDescendantsFinder
else else
direct_child_groups direct_child_groups
end end
groups.with_selects_for_list(archived: params[:archived]).order_by(sort) groups.with_selects_for_list(archived: params[:archived]).order_by(sort)
end end
...@@ -140,6 +142,7 @@ class GroupDescendantsFinder ...@@ -140,6 +142,7 @@ class GroupDescendantsFinder
else else
direct_child_projects direct_child_projects
end end
projects.with_route.order_by(sort) projects.with_route.order_by(sort)
end end
......
...@@ -34,6 +34,7 @@ class GroupProjectsFinder < ProjectsFinder ...@@ -34,6 +34,7 @@ class GroupProjectsFinder < ProjectsFinder
else else
collection_without_user collection_without_user
end end
union(projects) union(projects)
end end
......
...@@ -62,6 +62,7 @@ module KerberosSpnegoHelper ...@@ -62,6 +62,7 @@ module KerberosSpnegoHelper
else else
nil # accept any valid service principal name from keytab nil # accept any valid service principal name from keytab
end end
gss.acquire_credentials(gss_service_name) # grab credentials from keytab gss.acquire_credentials(gss_service_name) # grab credentials from keytab
# Decode token # Decode token
......
...@@ -203,6 +203,7 @@ module MarkupHelper ...@@ -203,6 +203,7 @@ module MarkupHelper
node.content = node.content.truncate(num_remaining) node.content = node.content.truncate(num_remaining)
truncated = true truncated = true
end end
content_length += node.content.length content_length += node.content.length
end end
......
...@@ -86,6 +86,7 @@ module MergeRequestsHelper ...@@ -86,6 +86,7 @@ module MergeRequestsHelper
approvers_names = merge_request.approvers_left.map(&:name) approvers_names = merge_request.approvers_left.map(&:name)
str << str <<
if more_approvals > 0 if more_approvals > 0
" (from #{render_items_list(approvers_names + ["#{more_approvals} more"])})" " (from #{render_items_list(approvers_names + ["#{more_approvals} more"])})"
elsif more_approvals < 0 elsif more_approvals < 0
......
...@@ -163,6 +163,7 @@ module MilestonesHelper ...@@ -163,6 +163,7 @@ module MilestonesHelper
def show_burndown_placeholder?(warning) def show_burndown_placeholder?(warning)
return false if cookies['hide_burndown_message'].present? return false if cookies['hide_burndown_message'].present?
return false unless @project.feature_available?(:burndown_charts, current_user) && return false unless @project.feature_available?(:burndown_charts, current_user) &&
@project.feature_available?(:issue_weights, current_user) @project.feature_available?(:issue_weights, current_user)
......
...@@ -13,6 +13,7 @@ module NavHelper ...@@ -13,6 +13,7 @@ module NavHelper
current_path?('issues#show') || current_path?('issues#show') ||
current_path?('milestones#show') || current_path?('milestones#show') ||
current_path?('epics#show') current_path?('epics#show')
if cookies[:collapsed_gutter] == 'true' if cookies[:collapsed_gutter] == 'true'
%w[page-gutter right-sidebar-collapsed] %w[page-gutter right-sidebar-collapsed]
else else
......
...@@ -89,6 +89,7 @@ module SnippetsHelper ...@@ -89,6 +89,7 @@ module SnippetsHelper
snippet_chunk = [lined_content[line_number]] snippet_chunk = [lined_content[line_number]]
snippet_start_line = line_number snippet_start_line = line_number
end end
last_line = line_number last_line = line_number
end end
# Add final chunk to chunk array # Add final chunk to chunk array
......
...@@ -58,6 +58,7 @@ module SubmoduleHelper ...@@ -58,6 +58,7 @@ module SubmoduleHelper
url_no_dotgit = url.chomp('.git') url_no_dotgit = url.chomp('.git')
return true if url_no_dotgit == [Gitlab.config.gitlab.url, '/', namespace, '/', return true if url_no_dotgit == [Gitlab.config.gitlab.url, '/', namespace, '/',
project].join('') project].join('')
url_with_dotgit = url_no_dotgit + '.git' url_with_dotgit = url_no_dotgit + '.git'
url_with_dotgit == Gitlab::Shell.new.url_to_repo([namespace, '/', project].join('')) url_with_dotgit == Gitlab::Shell.new.url_to_repo([namespace, '/', project].join(''))
end end
......
...@@ -30,6 +30,7 @@ module TodosHelper ...@@ -30,6 +30,7 @@ module TodosHelper
else else
todo.target_reference todo.target_reference
end end
link_to text, todo_target_path(todo), class: 'has-tooltip', title: todo.target.title link_to text, todo_target_path(todo), class: 'has-tooltip', title: todo.target.title
end end
......
...@@ -465,6 +465,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -465,6 +465,7 @@ class ApplicationSetting < ActiveRecord::Base
super(group_full_path) super(group_full_path)
Gitlab::PerformanceBar.expire_allowed_user_ids_cache Gitlab::PerformanceBar.expire_allowed_user_ids_cache
end end
return return
end end
......
...@@ -324,6 +324,7 @@ module Issuable ...@@ -324,6 +324,7 @@ module Issuable
includes = [] includes = []
includes << :author unless notes.authors_loaded? includes << :author unless notes.authors_loaded?
includes << :award_emoji unless notes.award_emojis_loaded? includes << :award_emoji unless notes.award_emojis_loaded?
if includes.any? if includes.any?
notes.includes(includes) notes.includes(includes)
else else
......
...@@ -25,6 +25,7 @@ module LoadedInGroupList ...@@ -25,6 +25,7 @@ module LoadedInGroupList
base_count = projects.project(Arel.star.count.as('preloaded_project_count')) base_count = projects.project(Arel.star.count.as('preloaded_project_count'))
.where(projects[:namespace_id].eq(namespaces[:id])) .where(projects[:namespace_id].eq(namespaces[:id]))
if archived == 'only' if archived == 'only'
base_count.where(projects[:archived].eq(true)) base_count.where(projects[:archived].eq(true))
elsif Gitlab::Utils.to_boolean(archived) elsif Gitlab::Utils.to_boolean(archived)
......
...@@ -135,6 +135,7 @@ class Label < ActiveRecord::Base ...@@ -135,6 +135,7 @@ class Label < ActiveRecord::Base
else else
priorities.find_by(project: project) priorities.find_by(project: project)
end end
priority.try(:priority) priority.try(:priority)
end end
......
...@@ -819,6 +819,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -819,6 +819,7 @@ class MergeRequest < ActiveRecord::Base
if !include_description && closes_issues_references.present? if !include_description && closes_issues_references.present?
message << "Closes #{closes_issues_references.to_sentence}" message << "Closes #{closes_issues_references.to_sentence}"
end end
message << "#{description}" if include_description && description.present? message << "#{description}" if include_description && description.present?
message << "See merge request #{to_reference(full: true)}" message << "See merge request #{to_reference(full: true)}"
......
...@@ -224,6 +224,7 @@ module Network ...@@ -224,6 +224,7 @@ module Network
space_base = parents.first.space space_base = parents.first.space
end end
end end
space_base space_base
end end
......
...@@ -9,6 +9,7 @@ class NotificationRecipient ...@@ -9,6 +9,7 @@ class NotificationRecipient
group: nil, group: nil,
skip_read_ability: false skip_read_ability: false
) )
unless NotificationSetting.levels.key?(type) || type == :subscription unless NotificationSetting.levels.key?(type) || type == :subscription
raise ArgumentError, "invalid type: #{type.inspect}" raise ArgumentError, "invalid type: #{type.inspect}"
end end
......
...@@ -643,6 +643,7 @@ class Project < ActiveRecord::Base ...@@ -643,6 +643,7 @@ class Project < ActiveRecord::Base
project_import_data.data ||= {} project_import_data.data ||= {}
project_import_data.data = project_import_data.data.merge(data) project_import_data.data = project_import_data.data.merge(data)
end end
if credentials if credentials
project_import_data.credentials ||= {} project_import_data.credentials ||= {}
project_import_data.credentials = project_import_data.credentials.merge(credentials) project_import_data.credentials = project_import_data.credentials.merge(credentials)
......
...@@ -110,6 +110,7 @@ class HipchatService < Service ...@@ -110,6 +110,7 @@ class HipchatService < Service
message = "" message = ""
message << "#{push[:user_name]} " message << "#{push[:user_name]} "
if Gitlab::Git.blank_ref?(before) if Gitlab::Git.blank_ref?(before)
message << "pushed new #{ref_type} <a href=\""\ message << "pushed new #{ref_type} <a href=\""\
"#{project_url}/commits/#{CGI.escape(ref)}\">#{ref}</a>"\ "#{project_url}/commits/#{CGI.escape(ref)}\">#{ref}</a>"\
......
...@@ -1073,6 +1073,7 @@ class Repository ...@@ -1073,6 +1073,7 @@ class Repository
else else
cache.fetch(key, &block) cache.fetch(key, &block)
end end
instance_variable_set(ivar, value) instance_variable_set(ivar, value)
rescue Rugged::ReferenceError, Gitlab::Git::Repository::NoRepository rescue Rugged::ReferenceError, Gitlab::Git::Repository::NoRepository
# Even if the above `#exists?` check passes these errors might still # Even if the above `#exists?` check passes these errors might still
......
...@@ -252,6 +252,7 @@ class Service < ActiveRecord::Base ...@@ -252,6 +252,7 @@ class Service < ActiveRecord::Base
teamcity teamcity
microsoft_teams microsoft_teams
] ]
if Rails.env.development? if Rails.env.development?
service_names += %w[mock_ci mock_deployment mock_monitoring] service_names += %w[mock_ci mock_deployment mock_monitoring]
end end
......
...@@ -16,6 +16,7 @@ class CreateDeploymentService ...@@ -16,6 +16,7 @@ class CreateDeploymentService
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
environment.external_url = expanded_environment_url if environment.external_url = expanded_environment_url if
expanded_environment_url expanded_environment_url
environment.fire_state_event(action) environment.fire_state_event(action)
return unless environment.save return unless environment.save
......
...@@ -13,6 +13,7 @@ class PagesWorker ...@@ -13,6 +13,7 @@ class PagesWorker
if result[:status] == :success if result[:status] == :success
result = Projects::UpdatePagesConfigurationService.new(build.project).execute result = Projects::UpdatePagesConfigurationService.new(build.project).execute
end end
result result
end end
......
---
title: Adds Rubocop rule for line break around conditionals
merge_request: 15739
author: Jacopo Beschi @jacopo-beschi
type: added
...@@ -166,6 +166,7 @@ module Gitlab ...@@ -166,6 +166,7 @@ module Gitlab
caching_config_hash[:pool_size] = Sidekiq.options[:concurrency] + 5 caching_config_hash[:pool_size] = Sidekiq.options[:concurrency] + 5
caching_config_hash[:pool_timeout] = 1 caching_config_hash[:pool_timeout] = 1
end end
config.cache_store = :redis_store, caching_config_hash config.cache_store = :redis_store, caching_config_hash
config.active_record.raise_in_transactional_callbacks = true config.active_record.raise_in_transactional_callbacks = true
......
...@@ -93,6 +93,7 @@ class Settings < Settingslogic ...@@ -93,6 +93,7 @@ class Settings < Settingslogic
end end
values.delete_if { |value| value.nil? } values.delete_if { |value| value.nil? }
end end
values values
end end
...@@ -103,6 +104,7 @@ class Settings < Settingslogic ...@@ -103,6 +104,7 @@ class Settings < Settingslogic
if current.is_a? String if current.is_a? String
value = modul.const_get(current.upcase) rescue default value = modul.const_get(current.upcase) rescue default
end end
value value
end end
......
...@@ -241,6 +241,7 @@ Devise.setup do |config| ...@@ -241,6 +241,7 @@ Devise.setup do |config|
true true
end end
end end
if provider['name'] == 'authentiq' if provider['name'] == 'authentiq'
provider['args'][:remote_sign_out_handler] = lambda do |request| provider['args'][:remote_sign_out_handler] = lambda do |request|
authentiq_session = request.params['sid'] authentiq_session = request.params['sid']
......
...@@ -2,6 +2,7 @@ Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Re ...@@ -2,6 +2,7 @@ Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Re
Peek.into Peek::Views::Host Peek.into Peek::Views::Host
Peek.into Peek::Views::PerformanceBar Peek.into Peek::Views::PerformanceBar
if Gitlab::Database.mysql? if Gitlab::Database.mysql?
require 'peek-mysql2' require 'peek-mysql2'
PEEK_DB_CLIENT = ::Mysql2::Client PEEK_DB_CLIENT = ::Mysql2::Client
...@@ -11,6 +12,7 @@ else ...@@ -11,6 +12,7 @@ else
PEEK_DB_CLIENT = ::PG::Connection PEEK_DB_CLIENT = ::PG::Connection
PEEK_DB_VIEW = Peek::Views::PG PEEK_DB_VIEW = Peek::Views::PG
end end
Peek.into PEEK_DB_VIEW Peek.into PEEK_DB_VIEW
Peek.into Peek::Views::Redis Peek.into Peek::Views::Redis
Peek.into Peek::Views::Sidekiq Peek.into Peek::Views::Sidekiq
......
...@@ -23,6 +23,7 @@ class CreateForkNetworks < ActiveRecord::Migration ...@@ -23,6 +23,7 @@ class CreateForkNetworks < ActiveRecord::Migration
if foreign_keys_for(:fork_networks, :root_project_id).any? if foreign_keys_for(:fork_networks, :root_project_id).any?
remove_foreign_key :fork_networks, column: :root_project_id remove_foreign_key :fork_networks, column: :root_project_id
end end
drop_table :fork_networks drop_table :fork_networks
end end
end end
...@@ -21,6 +21,7 @@ class CreateForkNetworkMembers < ActiveRecord::Migration ...@@ -21,6 +21,7 @@ class CreateForkNetworkMembers < ActiveRecord::Migration
if foreign_keys_for(:fork_network_members, :forked_from_project_id).any? if foreign_keys_for(:fork_network_members, :forked_from_project_id).any?
remove_foreign_key :fork_network_members, column: :forked_from_project_id remove_foreign_key :fork_network_members, column: :forked_from_project_id
end end
drop_table :fork_network_members drop_table :fork_network_members
end end
end end
...@@ -9,6 +9,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration ...@@ -9,6 +9,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration
return unless Gitlab::Database.postgresql? return unless Gitlab::Database.postgresql?
disable_statement_timeout disable_statement_timeout
if Gitlab::Database.version.to_f >= 9.5 if Gitlab::Database.version.to_f >= 9.5
# Allow us to hot-patch the index manually ahead of the migration # Allow us to hot-patch the index manually ahead of the migration
execute "CREATE INDEX CONCURRENTLY IF NOT EXISTS #{INDEX_NAME} ON namespaces (lower(name));" execute "CREATE INDEX CONCURRENTLY IF NOT EXISTS #{INDEX_NAME} ON namespaces (lower(name));"
...@@ -21,6 +22,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration ...@@ -21,6 +22,7 @@ class AddIndexOnNamespacesLowerName < ActiveRecord::Migration
return unless Gitlab::Database.postgresql? return unless Gitlab::Database.postgresql?
disable_statement_timeout disable_statement_timeout
if Gitlab::Database.version.to_f >= 9.2 if Gitlab::Database.version.to_f >= 9.2
execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME};" execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME};"
else else
......
...@@ -31,6 +31,7 @@ class RenameUsersWithRenamedNamespace < ActiveRecord::Migration ...@@ -31,6 +31,7 @@ class RenameUsersWithRenamedNamespace < ActiveRecord::Migration
predicate = namespaces[:owner_id].eq(users[:id]) predicate = namespaces[:owner_id].eq(users[:id])
.and(namespaces[:type].eq(nil)) .and(namespaces[:type].eq(nil))
.and(users[:username].matches(path)) .and(users[:username].matches(path))
update_sql = if Gitlab::Database.postgresql? update_sql = if Gitlab::Database.postgresql?
"UPDATE users SET username = namespaces.path "\ "UPDATE users SET username = namespaces.path "\
"FROM namespaces WHERE #{predicate.to_sql}" "FROM namespaces WHERE #{predicate.to_sql}"
......
...@@ -4,6 +4,7 @@ module EE ...@@ -4,6 +4,7 @@ module EE
module GroupsController module GroupsController
def reset_runners_minutes def reset_runners_minutes
group group
if ClearNamespaceSharedRunnersMinutesService.new(@group).execute if ClearNamespaceSharedRunnersMinutesService.new(@group).execute
redirect_to [:admin, @group], notice: 'Group pipeline minutes were successfully reset.' redirect_to [:admin, @group], notice: 'Group pipeline minutes were successfully reset.'
else else
......
...@@ -4,6 +4,7 @@ module EE ...@@ -4,6 +4,7 @@ module EE
module UsersController module UsersController
def reset_runners_minutes def reset_runners_minutes
user user
if ClearNamespaceSharedRunnersMinutesService.new(@user.namespace).execute if ClearNamespaceSharedRunnersMinutesService.new(@user.namespace).execute
redirect_to [:admin, @user], notice: 'User pipeline minutes were successfully reset.' redirect_to [:admin, @user], notice: 'User pipeline minutes were successfully reset.'
else else
......
...@@ -18,6 +18,7 @@ class Projects::PushRulesController < Projects::ApplicationController ...@@ -18,6 +18,7 @@ class Projects::PushRulesController < Projects::ApplicationController
else else
flash[:alert] = @push_rule.errors.full_messages.join(', ').html_safe flash[:alert] = @push_rule.errors.full_messages.join(', ').html_safe
end end
redirect_to_repository_settings(@project) redirect_to_repository_settings(@project)
end end
......
...@@ -13,6 +13,7 @@ class UnsubscribesController < ApplicationController ...@@ -13,6 +13,7 @@ class UnsubscribesController < ApplicationController
@user.admin_unsubscribe! @user.admin_unsubscribe!
Notify.send_unsubscribed_notification(@user.id).deliver_later Notify.send_unsubscribed_notification(@user.id).deliver_later
end end
redirect_to new_user_session_path, notice: 'You have been unsubscribed' redirect_to new_user_session_path, notice: 'You have been unsubscribed'
end end
......
...@@ -30,6 +30,7 @@ module LicenseHelper ...@@ -30,6 +30,7 @@ module LicenseHelper
message << block_changes_message message << block_changes_message
message << message <<
if is_admin if is_admin
'Upload a new license in the admin area' 'Upload a new license in the admin area'
else else
......
...@@ -21,11 +21,13 @@ class LdapGroupSyncWorker ...@@ -21,11 +21,13 @@ class LdapGroupSyncWorker
def sync_group(group, proxy: nil) def sync_group(group, proxy: nil)
logger.info "Started LDAP group sync for group #{group.name} (#{group.id})" logger.info "Started LDAP group sync for group #{group.name} (#{group.id})"
if proxy if proxy
EE::Gitlab::LDAP::Sync::Group.execute(group, proxy) EE::Gitlab::LDAP::Sync::Group.execute(group, proxy)
else else
EE::Gitlab::LDAP::Sync::Group.execute_all_providers(group) EE::Gitlab::LDAP::Sync::Group.execute_all_providers(group)
end end
logger.info "Finished LDAP group sync for group #{group.name} (#{group.id})" logger.info "Finished LDAP group sync for group #{group.name} (#{group.id})"
end end
end end
...@@ -10,6 +10,7 @@ module SystemCheck ...@@ -10,6 +10,7 @@ module SystemCheck
def multi_check def multi_check
$stdout.puts $stdout.puts
if Gitlab::Geo.primary? if Gitlab::Geo.primary?
Gitlab::Geo.secondary_nodes.each do |node| Gitlab::Geo.secondary_nodes.each do |node|
$stdout.print "* Can connect to secondary node: '#{node.url}' ... " $stdout.print "* Can connect to secondary node: '#{node.url}' ... "
......
...@@ -180,11 +180,13 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps ...@@ -180,11 +180,13 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
dropdown.find(".compare-dropdown-toggle").click dropdown.find(".compare-dropdown-toggle").click
dropdown.find('.dropdown-menu', visible: true) dropdown.find('.dropdown-menu', visible: true)
dropdown.fill_in("Filter by Git revision", with: selection) dropdown.fill_in("Filter by Git revision", with: selection)
if is_commit if is_commit
dropdown.find('input[type="search"]').send_keys(:return) dropdown.find('input[type="search"]').send_keys(:return)
else else
find_link(selection, visible: true).click find_link(selection, visible: true).click
end end
dropdown.find('.dropdown-menu', visible: false) dropdown.find('.dropdown-menu', visible: false)
end end
end end
...@@ -256,6 +256,7 @@ module API ...@@ -256,6 +256,7 @@ module API
if group.pending_ldap_sync if group.pending_ldap_sync
LdapGroupSyncWorker.perform_async(group.id) LdapGroupSyncWorker.perform_async(group.id)
end end
status 202 status 202
end end
end end
......
...@@ -29,6 +29,7 @@ module API ...@@ -29,6 +29,7 @@ module API
check_unmodified_since!(last_updated) check_unmodified_since!(last_updated)
status 204 status 204
if block_given? if block_given?
yield resource yield resource
else else
......
...@@ -103,6 +103,7 @@ module API ...@@ -103,6 +103,7 @@ module API
elsif params[:user_id] elsif params[:user_id]
user = User.find_by(id: params[:user_id]) user = User.find_by(id: params[:user_id])
end end
present user, with: Entities::UserSafe present user, with: Entities::UserSafe
end end
......
...@@ -180,6 +180,7 @@ module API ...@@ -180,6 +180,7 @@ module API
issue = ::Issues::CreateService.new(user_project, issue = ::Issues::CreateService.new(user_project,
current_user, current_user,
issue_params.merge(request: request, api: true)).execute issue_params.merge(request: request, api: true)).execute
if issue.spam? if issue.spam?
render_api_error!({ error: 'Spam detected' }, 400) render_api_error!({ error: 'Spam detected' }, 400)
end end
......
...@@ -48,6 +48,7 @@ module API ...@@ -48,6 +48,7 @@ module API
current_user, current_user,
declared_params(include_missing: false)) declared_params(include_missing: false))
.execute(:api, ignore_skip_ci: true, save_on_errors: false) .execute(:api, ignore_skip_ci: true, save_on_errors: false)
if new_pipeline.persisted? if new_pipeline.persisted?
present new_pipeline, with: Entities::Pipeline present new_pipeline, with: Entities::Pipeline
else else
......
...@@ -13,6 +13,7 @@ module API ...@@ -13,6 +13,7 @@ module API
if errors[:project_access].any? if errors[:project_access].any?
error!(errors[:project_access], 422) error!(errors[:project_access], 422)
end end
not_found! not_found!
end end
......
...@@ -160,6 +160,7 @@ module API ...@@ -160,6 +160,7 @@ module API
if project.errors[:limit_reached].present? if project.errors[:limit_reached].present?
error!(project.errors[:limit_reached], 403) error!(project.errors[:limit_reached], 403)
end end
render_validation_error!(project) render_validation_error!(project)
end end
end end
......
...@@ -15,6 +15,7 @@ module API ...@@ -15,6 +15,7 @@ module API
if errors[:project_access].any? if errors[:project_access].any?
error!(errors[:project_access], 422) error!(errors[:project_access], 422)
end end
not_found! not_found!
end end
......
...@@ -67,6 +67,7 @@ module API ...@@ -67,6 +67,7 @@ module API
unless member unless member
member = source.add_user(params[:user_id], params[:access_level], current_user: current_user, expires_at: params[:expires_at]) member = source.add_user(params[:user_id], params[:access_level], current_user: current_user, expires_at: params[:expires_at])
end end
if member.persisted? && member.valid? if member.persisted? && member.valid?
present member.user, with: ::API::Entities::Member, member: member present member.user, with: ::API::Entities::Member, member: member
else else
......
...@@ -128,6 +128,7 @@ module API ...@@ -128,6 +128,7 @@ module API
if status == :deprecated if status == :deprecated
detail DEPRECATION_MESSAGE detail DEPRECATION_MESSAGE
end end
success ::API::V3::Entities::MergeRequest success ::API::V3::Entities::MergeRequest
end end
get path do get path do
......
...@@ -14,6 +14,7 @@ module API ...@@ -14,6 +14,7 @@ module API
if errors[:project_access].any? if errors[:project_access].any?
error!(errors[:project_access], 422) error!(errors[:project_access], 422)
end end
not_found! not_found!
end end
......
...@@ -45,6 +45,7 @@ module API ...@@ -45,6 +45,7 @@ module API
# private or internal, use the more conservative option, private. # private or internal, use the more conservative option, private.
attrs[:visibility_level] = (publik == true) ? Gitlab::VisibilityLevel::PUBLIC : Gitlab::VisibilityLevel::PRIVATE attrs[:visibility_level] = (publik == true) ? Gitlab::VisibilityLevel::PUBLIC : Gitlab::VisibilityLevel::PRIVATE
end end
attrs attrs
end end
...@@ -205,6 +206,7 @@ module API ...@@ -205,6 +206,7 @@ module API
if project.errors[:limit_reached].present? if project.errors[:limit_reached].present?
error!(project.errors[:limit_reached], 403) error!(project.errors[:limit_reached], 403)
end end
render_validation_error!(project) render_validation_error!(project)
end end
end end
......
...@@ -14,6 +14,7 @@ module API ...@@ -14,6 +14,7 @@ module API
if errors[:project_access].any? if errors[:project_access].any?
error!(errors[:project_access], 422) error!(errors[:project_access], 422)
end end
not_found! not_found!
end end
end end
......
...@@ -97,6 +97,7 @@ module API ...@@ -97,6 +97,7 @@ module API
attrs = declared_params(include_missing: false) attrs = declared_params(include_missing: false)
UpdateSnippetService.new(nil, current_user, snippet, attrs).execute UpdateSnippetService.new(nil, current_user, snippet, attrs).execute
if snippet.persisted? if snippet.persisted?
present snippet, with: ::API::Entities::PersonalSnippet present snippet, with: ::API::Entities::PersonalSnippet
else else
......
...@@ -31,6 +31,7 @@ module Backup ...@@ -31,6 +31,7 @@ module Backup
pgsql_args << "-n" pgsql_args << "-n"
pgsql_args << Gitlab.config.backup.pg_schema pgsql_args << Gitlab.config.backup.pg_schema
end end
spawn('pg_dump', *pgsql_args, config['database'], out: compress_wr) spawn('pg_dump', *pgsql_args, config['database'], out: compress_wr)
end end
compress_wr.close compress_wr.close
......
...@@ -47,6 +47,7 @@ module Backup ...@@ -47,6 +47,7 @@ module Backup
if File.exist?(path_to_wiki_repo) if File.exist?(path_to_wiki_repo)
progress.print " * #{display_repo_path(wiki)} ... " progress.print " * #{display_repo_path(wiki)} ... "
if empty_repo?(wiki) if empty_repo?(wiki)
progress.puts " [SKIPPED]".color(:cyan) progress.puts " [SKIPPED]".color(:cyan)
else else
......
...@@ -148,6 +148,7 @@ module Gitlab ...@@ -148,6 +148,7 @@ module Gitlab
stream.seek(@offset) stream.seek(@offset)
append = @offset > 0 append = @offset > 0
end end
start_offset = @offset start_offset = @offset
open_new_tag open_new_tag
...@@ -155,6 +156,7 @@ module Gitlab ...@@ -155,6 +156,7 @@ module Gitlab
stream.each_line do |line| stream.each_line do |line|
s = StringScanner.new(line) s = StringScanner.new(line)
until s.eos? until s.eos?
if s.scan(Gitlab::Regex.build_trace_section_regex) if s.scan(Gitlab::Regex.build_trace_section_regex)
handle_section(s) handle_section(s)
elsif s.scan(/\e([@-_])(.*?)([@-~])/) elsif s.scan(/\e([@-_])(.*?)([@-~])/)
...@@ -168,6 +170,7 @@ module Gitlab ...@@ -168,6 +170,7 @@ module Gitlab
else else
@out << s.scan(/./m) @out << s.scan(/./m)
end end
@offset += s.matched_size @offset += s.matched_size
end end
end end
...@@ -236,8 +239,10 @@ module Gitlab ...@@ -236,8 +239,10 @@ module Gitlab
if @style_mask & STYLE_SWITCHES[:bold] != 0 if @style_mask & STYLE_SWITCHES[:bold] != 0
fg_color.sub!(/fg-([a-z]{2,}+)/, 'fg-l-\1') fg_color.sub!(/fg-([a-z]{2,}+)/, 'fg-l-\1')
end end
css_classes << fg_color css_classes << fg_color
end end
css_classes << @bg_color unless @bg_color.nil? css_classes << @bg_color unless @bg_color.nil?
STYLE_SWITCHES.each do |css_class, flag| STYLE_SWITCHES.each do |css_class, flag|
......
...@@ -512,6 +512,7 @@ module Gitlab ...@@ -512,6 +512,7 @@ module Gitlab
batch_size: 10_000, batch_size: 10_000,
interval: 10.minutes interval: 10.minutes
) )
unless relation.model < EachBatch unless relation.model < EachBatch
raise TypeError, 'The relation must include the EachBatch module' raise TypeError, 'The relation must include the EachBatch module'
end end
......
...@@ -26,6 +26,7 @@ module Gitlab ...@@ -26,6 +26,7 @@ module Gitlab
move_repository(project, old_full_path, new_full_path) move_repository(project, old_full_path, new_full_path)
move_repository(project, "#{old_full_path}.wiki", "#{new_full_path}.wiki") move_repository(project, "#{old_full_path}.wiki", "#{new_full_path}.wiki")
end end
move_uploads(old_full_path, new_full_path) unless project.hashed_storage?(:attachments) move_uploads(old_full_path, new_full_path) unless project.hashed_storage?(:attachments)
move_pages(old_full_path, new_full_path) move_pages(old_full_path, new_full_path)
end end
......
...@@ -14,6 +14,7 @@ module Gitlab ...@@ -14,6 +14,7 @@ module Gitlab
else else
@diff_lines = diff_lines @diff_lines = diff_lines
end end
@raw_lines = @diff_lines.map(&:text) @raw_lines = @diff_lines.map(&:text)
end end
......
...@@ -156,12 +156,14 @@ module Gitlab ...@@ -156,12 +156,14 @@ module Gitlab
%W[git apply --3way #{patch_path}] %W[git apply --3way #{patch_path}]
) do |output, status| ) do |output, status|
puts output puts output
unless status.zero? unless status.zero?
@failed_files = output.lines.reduce([]) do |memo, line| @failed_files = output.lines.reduce([]) do |memo, line|
if line.start_with?('error: patch failed:') if line.start_with?('error: patch failed:')
file = line.sub(/\Aerror: patch failed: /, '') file = line.sub(/\Aerror: patch failed: /, '')
memo << file unless file =~ IGNORED_FILES_REGEX memo << file unless file =~ IGNORED_FILES_REGEX
end end
memo memo
end end
......
...@@ -10,6 +10,7 @@ module Gitlab ...@@ -10,6 +10,7 @@ module Gitlab
def initialize(mail, mail_key) def initialize(mail, mail_key)
super(mail, mail_key) super(mail, mail_key)
if m = /\A([^\+]*)\+merge-request\+(.*)/.match(mail_key.to_s) if m = /\A([^\+]*)\+merge-request\+(.*)/.match(mail_key.to_s)
@project_path, @incoming_email_token = m.captures @project_path, @incoming_email_token = m.captures
end end
......
...@@ -112,6 +112,7 @@ module Gitlab ...@@ -112,6 +112,7 @@ module Gitlab
[bug['sCategory'], bug['sPriority']].each do |label| [bug['sCategory'], bug['sPriority']].each do |label|
unless label.blank? unless label.blank?
labels << label labels << label
unless @known_labels.include?(label) unless @known_labels.include?(label)
create_label(label) create_label(label)
@known_labels << label @known_labels << label
...@@ -265,6 +266,7 @@ module Gitlab ...@@ -265,6 +266,7 @@ module Gitlab
if content.blank? if content.blank?
content = '*(No description has been entered for this issue)*' content = '*(No description has been entered for this issue)*'
end end
body << content body << content
body.join("\n\n") body.join("\n\n")
...@@ -278,6 +280,7 @@ module Gitlab ...@@ -278,6 +280,7 @@ module Gitlab
if content.blank? if content.blank?
content = "*(No comment has been entered for this change)*" content = "*(No comment has been entered for this change)*"
end end
body << content body << content
if updates.any? if updates.any?
......
...@@ -654,6 +654,7 @@ module Gitlab ...@@ -654,6 +654,7 @@ module Gitlab
end end
end end
end end
@refs_hash @refs_hash
end end
......
...@@ -27,6 +27,7 @@ module Gitlab ...@@ -27,6 +27,7 @@ module Gitlab
status = nil status = nil
while status.nil? while status.nil?
if deadline > Time.now.utc if deadline > Time.now.utc
sleep(wait_time) sleep(wait_time)
_pid, status = Process.wait2(filesystem_check_pid, Process::WNOHANG) _pid, status = Process.wait2(filesystem_check_pid, Process::WNOHANG)
......
...@@ -52,6 +52,7 @@ module Gitlab ...@@ -52,6 +52,7 @@ module Gitlab
) )
response = GitalyClient.call(@repository.storage, :operation_service, response = GitalyClient.call(@repository.storage, :operation_service,
:user_create_branch, request) :user_create_branch, request)
if response.pre_receive_error.present? if response.pre_receive_error.present?
raise Gitlab::Git::HooksService::PreReceiveError.new(response.pre_receive_error) raise Gitlab::Git::HooksService::PreReceiveError.new(response.pre_receive_error)
end end
......
...@@ -302,6 +302,7 @@ module Gitlab ...@@ -302,6 +302,7 @@ module Gitlab
else else
"#{project.namespace.full_path}/#{name}##{id}" "#{project.namespace.full_path}/#{name}##{id}"
end end
text = "~~#{text}~~" if deleted text = "~~#{text}~~" if deleted
text text
end end
...@@ -329,6 +330,7 @@ module Gitlab ...@@ -329,6 +330,7 @@ module Gitlab
if content.blank? if content.blank?
content = "*(No comment has been entered for this change)*" content = "*(No comment has been entered for this change)*"
end end
body << content body << content
if updates.any? if updates.any?
...@@ -352,6 +354,7 @@ module Gitlab ...@@ -352,6 +354,7 @@ module Gitlab
if content.blank? if content.blank?
content = "*(No description has been entered for this issue)*" content = "*(No description has been entered for this issue)*"
end end
body << content body << content
if attachments.any? if attachments.any?
......
...@@ -148,6 +148,7 @@ module Gitlab ...@@ -148,6 +148,7 @@ module Gitlab
else else
relation_hash = relation_item[sub_relation.to_s] relation_hash = relation_item[sub_relation.to_s]
end end
[relation_hash, sub_relation] [relation_hash, sub_relation]
end end
......
...@@ -267,6 +267,7 @@ module Gitlab ...@@ -267,6 +267,7 @@ module Gitlab
else else
%w[title group_id] %w[title group_id]
end end
finder_hash = parsed_relation_hash.slice(*finder_attributes) finder_hash = parsed_relation_hash.slice(*finder_attributes)
if label? if label?
......
...@@ -14,6 +14,7 @@ module Gitlab ...@@ -14,6 +14,7 @@ module Gitlab
generate_config_map generate_config_map
spec['volumes'] = volumes_specification spec['volumes'] = volumes_specification
end end
::Kubeclient::Resource.new(metadata: metadata, spec: spec) ::Kubeclient::Resource.new(metadata: metadata, spec: spec)
end end
......
...@@ -171,6 +171,7 @@ module Gitlab ...@@ -171,6 +171,7 @@ module Gitlab
end end
end end
end end
@pool @pool
end end
end end
......
...@@ -47,6 +47,7 @@ module Gitlab ...@@ -47,6 +47,7 @@ module Gitlab
else else
value = decorate_params_value(value, @request.params[key], tmp_path) value = decorate_params_value(value, @request.params[key], tmp_path)
end end
@request.update_param(key, value) @request.update_param(key, value)
end end
...@@ -60,6 +61,7 @@ module Gitlab ...@@ -60,6 +61,7 @@ module Gitlab
unless path_hash.is_a?(Hash) && path_hash.count == 1 unless path_hash.is_a?(Hash) && path_hash.count == 1
raise "invalid path: #{path_hash.inspect}" raise "invalid path: #{path_hash.inspect}"
end end
path_key, path_value = path_hash.first path_key, path_value = path_hash.first
unless value_hash.is_a?(Hash) && value_hash[path_key] unless value_hash.is_a?(Hash) && value_hash[path_key]
......
...@@ -37,6 +37,7 @@ module Gitlab ...@@ -37,6 +37,7 @@ module Gitlab
else else
per_page - first_collection_last_page_size per_page - first_collection_last_page_size
end end
hash[page] = second_collection.page(second_collection_page) hash[page] = second_collection.page(second_collection_page)
.per(per_page - paginated_first_collection(page).size) .per(per_page - paginated_first_collection(page).size)
.padding(offset) .padding(offset)
......
...@@ -126,6 +126,7 @@ module Gitlab ...@@ -126,6 +126,7 @@ module Gitlab
command << match_data[1] unless match_data[1].empty? command << match_data[1] unless match_data[1].empty?
commands << command commands << command
end end
content = substitution.perform_substitution(self, content) content = substitution.perform_substitution(self, content)
end end
......
...@@ -24,6 +24,7 @@ module Gitlab ...@@ -24,6 +24,7 @@ module Gitlab
# the pool will be used in a multi-threaded context # the pool will be used in a multi-threaded context
size += Sidekiq.options[:concurrency] size += Sidekiq.options[:concurrency]
end end
size size
end end
...@@ -104,6 +105,7 @@ module Gitlab ...@@ -104,6 +105,7 @@ module Gitlab
db_numbers = queries["db"] if queries.key?("db") db_numbers = queries["db"] if queries.key?("db")
config[:db] = db_numbers[0].to_i if db_numbers.any? config[:db] = db_numbers[0].to_i if db_numbers.any?
end end
config config
else else
redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(redis_url) redis_hash = ::Redis::Store::Factory.extract_host_options_from_uri(redis_url)
......
...@@ -115,6 +115,7 @@ module Gitlab ...@@ -115,6 +115,7 @@ module Gitlab
else else
merge_requests.full_search(query) merge_requests.full_search(query)
end end
merge_requests.order('updated_at DESC') merge_requests.order('updated_at DESC')
end end
......
...@@ -59,9 +59,11 @@ module Gitlab ...@@ -59,9 +59,11 @@ module Gitlab
if response.skipped_shards.any? if response.skipped_shards.any?
warnings << "Skipped shards: #{response.skipped_shards.join(', ')}" warnings << "Skipped shards: #{response.skipped_shards.join(', ')}"
end end
if response.failing_shards.any? if response.failing_shards.any?
warnings << "Failing shards: #{response.failing_shards.join(', ')}" warnings << "Failing shards: #{response.failing_shards.join(', ')}"
end end
logger.warn(warnings.join(' - ')) if warnings.any? logger.warn(warnings.join(' - ')) if warnings.any?
end end
end end
......
...@@ -37,12 +37,14 @@ module Gitlab ...@@ -37,12 +37,14 @@ module Gitlab
def call(env) def call(env)
increment_active_requests increment_active_requests
if block_requests? if block_requests?
block_request(env) block_request(env)
else else
sleep 0.2 if slow_requests? sleep 0.2 if slow_requests?
@app.call(env) @app.call(env)
end end
ensure ensure
decrement_active_requests decrement_active_requests
end end
......
...@@ -9,6 +9,7 @@ module Gitlab ...@@ -9,6 +9,7 @@ module Gitlab
else else
block.call block.call
end end
ensure ensure
model.record_timestamps = original_record_timestamps model.record_timestamps = original_record_timestamps
end end
......
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
puts "You are using the latest GitLab version" puts "You are using the latest GitLab version"
else else
puts "Newer GitLab version is available" puts "Newer GitLab version is available"
answer = if ARGV.first == "-y" answer = if ARGV.first == "-y"
"yes" "yes"
else else
...@@ -77,6 +78,7 @@ module Gitlab ...@@ -77,6 +78,7 @@ module Gitlab
update_commands.each do |title, cmd| update_commands.each do |title, cmd|
puts title puts title
puts " -> #{cmd.join(' ')}" puts " -> #{cmd.join(' ')}"
if system(env, *cmd) if system(env, *cmd)
puts " -> OK" puts " -> OK"
else else
......
...@@ -42,6 +42,7 @@ module Gitlab ...@@ -42,6 +42,7 @@ module Gitlab
else else
raise "Unsupported action: #{action}" raise "Unsupported action: #{action}"
end end
if feature_enabled if feature_enabled
params[:GitalyServer] = server params[:GitalyServer] = server
end end
......
...@@ -66,6 +66,7 @@ module SystemCheck ...@@ -66,6 +66,7 @@ module SystemCheck
if check.can_repair? if check.can_repair?
$stdout.print 'Trying to fix error automatically. ...' $stdout.print 'Trying to fix error automatically. ...'
if check.repair! if check.repair!
print_success print_success
return return
......
...@@ -72,6 +72,7 @@ namespace :geo do ...@@ -72,6 +72,7 @@ namespace :geo do
if Gitlab::Geo::DatabaseTasks.dump_schema_after_migration? if Gitlab::Geo::DatabaseTasks.dump_schema_after_migration?
ns["schema:dump"].invoke ns["schema:dump"].invoke
end end
# Allow this task to be called as many times as required. An example is the # Allow this task to be called as many times as required. An example is the
# migrate:redo task, which calls other two internally that depend on this one. # migrate:redo task, which calls other two internally that depend on this one.
ns['_dump'].reenable ns['_dump'].reenable
......
...@@ -46,6 +46,7 @@ namespace :gitlab do ...@@ -46,6 +46,7 @@ namespace :gitlab do
puts 'Removing all tables. Press `Ctrl-C` within 5 seconds to abort'.color(:yellow) puts 'Removing all tables. Press `Ctrl-C` within 5 seconds to abort'.color(:yellow)
sleep(5) sleep(5)
end end
# Drop all tables Load the schema to ensure we don't have any newer tables # Drop all tables Load the schema to ensure we don't have any newer tables
# hanging out from a failed upgrade # hanging out from a failed upgrade
$progress.puts 'Cleaning the database ... '.color(:blue) $progress.puts 'Cleaning the database ... '.color(:blue)
...@@ -222,6 +223,7 @@ namespace :gitlab do ...@@ -222,6 +223,7 @@ namespace :gitlab do
task restore: :environment do task restore: :environment do
$progress.puts "Restoring container registry images ... ".color(:blue) $progress.puts "Restoring container registry images ... ".color(:blue)
if Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
Backup::Registry.new.restore Backup::Registry.new.restore
$progress.puts "done".color(:green) $progress.puts "done".color(:green)
......
...@@ -183,6 +183,7 @@ namespace :gitlab do ...@@ -183,6 +183,7 @@ namespace :gitlab do
puts "can't check, you have no projects".color(:magenta) puts "can't check, you have no projects".color(:magenta)
return return
end end
puts "" puts ""
Project.find_each(batch_size: 100) do |project| Project.find_each(batch_size: 100) do |project|
...@@ -213,6 +214,7 @@ namespace :gitlab do ...@@ -213,6 +214,7 @@ namespace :gitlab do
gitlab_shell_repo_base = gitlab_shell_path gitlab_shell_repo_base = gitlab_shell_path
check_cmd = File.expand_path('bin/check', gitlab_shell_repo_base) check_cmd = File.expand_path('bin/check', gitlab_shell_repo_base)
puts "Running #{check_cmd}" puts "Running #{check_cmd}"
if system(check_cmd, chdir: gitlab_shell_repo_base) if system(check_cmd, chdir: gitlab_shell_repo_base)
puts 'gitlab-shell self-check successful'.color(:green) puts 'gitlab-shell self-check successful'.color(:green)
else else
...@@ -288,6 +290,7 @@ namespace :gitlab do ...@@ -288,6 +290,7 @@ namespace :gitlab do
return if process_count.zero? return if process_count.zero?
print 'Number of Sidekiq processes ... ' print 'Number of Sidekiq processes ... '
if process_count == 1 if process_count == 1
puts '1'.color(:green) puts '1'.color(:green)
else else
......
...@@ -57,6 +57,7 @@ namespace :gitlab do ...@@ -57,6 +57,7 @@ namespace :gitlab do
IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find| IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find|
find.each_line do |path| find.each_line do |path|
path.chomp! path.chomp!
if remove_flag if remove_flag
if FileUtils.rm_rf(path) if FileUtils.rm_rf(path)
puts "Removed...#{path}".color(:green) puts "Removed...#{path}".color(:green)
...@@ -113,6 +114,7 @@ namespace :gitlab do ...@@ -113,6 +114,7 @@ namespace :gitlab do
next unless user.ldap_user? next unless user.ldap_user?
print "#{user.name} (#{user.ldap_identity.extern_uid}) ..." print "#{user.name} (#{user.ldap_identity.extern_uid}) ..."
if Gitlab::LDAP::Access.allowed?(user) if Gitlab::LDAP::Access.allowed?(user)
puts " [OK]".color(:green) puts " [OK]".color(:green)
else else
......
...@@ -14,6 +14,7 @@ namespace :gitlab do ...@@ -14,6 +14,7 @@ namespace :gitlab do
puts "Must specify a branch as an argument".color(:red) puts "Must specify a branch as an argument".color(:red)
exit 1 exit 1
end end
args args
end end
......
...@@ -126,6 +126,7 @@ namespace :gitlab do ...@@ -126,6 +126,7 @@ namespace :gitlab do
puts 'Index mapping is already up to date'.color(:yellow) puts 'Index mapping is already up to date'.color(:yellow)
exit exit
end end
#### ####
project_fields = { project_fields = {
......
...@@ -5,9 +5,11 @@ namespace :gitlab do ...@@ -5,9 +5,11 @@ namespace :gitlab do
require 'toml' require 'toml'
warn_user_is_not_gitlab warn_user_is_not_gitlab
unless args.dir.present? unless args.dir.present?
abort %(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]") abort %(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]")
end end
args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git') args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git')
version = Gitlab::GitalyClient.expected_server_version version = Gitlab::GitalyClient.expected_server_version
......
...@@ -8,6 +8,7 @@ namespace :gitlab do ...@@ -8,6 +8,7 @@ namespace :gitlab do
namespace_ids = Namespace.where(['updated_at > ?', date]).pluck(:id).sort namespace_ids = Namespace.where(['updated_at > ?', date]).pluck(:id).sort
scope = scope.where('id IN (?) OR namespace_id in (?)', project_ids, namespace_ids) scope = scope.where('id IN (?) OR namespace_id in (?)', project_ids, namespace_ids)
end end
scope.find_each do |project| scope.find_each do |project|
base = File.join(project.repository_storage_path, project.disk_path) base = File.join(project.repository_storage_path, project.disk_path)
puts base + '.git' puts base + '.git'
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment