Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-26 15:08:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-26 15:08:30 +0300
commitd94409aaafb4b59464ebddfaa7821a286a8d1531 (patch)
tree1d13062b0ed95e30d6917683b3ff83e2ac138666 /lib
parent628f2eef70378076ef96ac0cf7c175d0516a5086 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/feature.rb6
-rw-r--r--lib/gitlab/access.rb6
-rw-r--r--lib/gitlab/access/branch_protection.rb4
-rw-r--r--lib/gitlab/database/gitlab_schema.rb16
4 files changed, 15 insertions, 17 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 3847f880be0..6c9bbc39844 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -326,7 +326,11 @@ module Feature
end
def l2_cache_backend
- ::Gitlab::Redis::FeatureFlag.cache_store
+ if !Gitlab::Utils.to_boolean(ENV['GITLAB_USE_FEATURE_FLAG_REDIS'])
+ Rails.cache
+ else
+ ::Gitlab::Redis::FeatureFlag.cache_store
+ end
end
def log(key:, action:, **extra)
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb
index bafda11170a..f1777e059ed 100644
--- a/lib/gitlab/access.rb
+++ b/lib/gitlab/access.rb
@@ -23,6 +23,7 @@ module Gitlab
PROTECTION_DEV_CAN_PUSH = 1
PROTECTION_FULL = 2
PROTECTION_DEV_CAN_MERGE = 3
+ PROTECTION_DEV_CAN_INITIAL_PUSH = 4
# Default project creation level
NO_ONE_PROJECT_ACCESS = 0
@@ -95,6 +96,11 @@ module Gitlab
label: s_('DefaultBranchProtection|Fully protected'),
help_text: s_('DefaultBranchProtection|Developers cannot push new commits, but maintainers can. No one can force push.'),
value: PROTECTION_FULL
+ },
+ {
+ label: s_('DefaultBranchProtection|Fully protected after initial push'),
+ help_text: s_('DefaultBranchProtection|Developers can push the initial commit to a repository, but none afterward. Maintainers can always push. No one can force push.'),
+ value: PROTECTION_DEV_CAN_INITIAL_PUSH
}
]
end
diff --git a/lib/gitlab/access/branch_protection.rb b/lib/gitlab/access/branch_protection.rb
index 339a99eb068..6ac8de407b0 100644
--- a/lib/gitlab/access/branch_protection.rb
+++ b/lib/gitlab/access/branch_protection.rb
@@ -34,6 +34,10 @@ module Gitlab
level == PROTECTION_DEV_CAN_PUSH
end
+ def developer_can_initial_push?
+ level == PROTECTION_DEV_CAN_INITIAL_PUSH
+ end
+
def developer_can_merge?
level == PROTECTION_DEV_CAN_MERGE
end
diff --git a/lib/gitlab/database/gitlab_schema.rb b/lib/gitlab/database/gitlab_schema.rb
index 4394c089b22..3d2e9f3f243 100644
--- a/lib/gitlab/database/gitlab_schema.rb
+++ b/lib/gitlab/database/gitlab_schema.rb
@@ -67,13 +67,6 @@ module Gitlab
# All `pg_` tables are marked as `internal`
return :gitlab_internal if table_name.start_with?('pg_')
-
- # Sometimes the name of an index can be interpreted as a table's name.
- # For eg, if we execute "ALTER INDEX my_index..", my_index is interpreted as a table name.
- # In such cases, we should return the schema of the database table actually
- # holding that index.
- index_name = table_name
- derive_schema_from_index(index_name)
end
# rubocop:enable Metrics/CyclomaticComplexity
@@ -131,15 +124,6 @@ module Gitlab
@schema_names ||= self.views_and_tables_to_schema.values.to_set
end
- private_class_method def self.derive_schema_from_index(index_name)
- index = Gitlab::Database::PostgresIndex.find_by(name: index_name,
- schema: ApplicationRecord.connection.current_schema)
-
- return unless index
-
- table_schema(index.tablename)
- end
-
private_class_method def self.build_dictionary(path_globs)
Dir.glob(path_globs).each_with_object({}) do |file_path, dic|
data = YAML.load_file(file_path)