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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/keep_around.rb')
-rw-r--r--lib/gitlab/git/keep_around.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/git/keep_around.rb b/lib/gitlab/git/keep_around.rb
index 38f0e47c4c7..5835a7001af 100644
--- a/lib/gitlab/git/keep_around.rb
+++ b/lib/gitlab/git/keep_around.rb
@@ -19,6 +19,8 @@ module Gitlab
end
def execute(shas)
+ return if disabled?
+
shas.uniq.each do |sha|
next unless sha.present? && commit_by(oid: sha)
@@ -32,6 +34,8 @@ module Gitlab
end
def kept_around?(sha)
+ return true if disabled?
+
ref_exists?(keep_around_ref_name(sha))
end
@@ -40,6 +44,11 @@ module Gitlab
private
+ def disabled?
+ Feature.enabled?(:disable_keep_around_refs, @repository, type: :ops) ||
+ (@repository.project && Feature.enabled?(:disable_keep_around_refs, @repository.project, type: :ops))
+ end
+
def keep_around_ref_name(sha)
"refs/#{::Repository::REF_KEEP_AROUND}/#{sha}"
end