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 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb41
1 files changed, 9 insertions, 32 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 119d874a6e1..47482f04bca 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -731,10 +731,8 @@ class Repository
raw_repository.local_branches(sort_by: sort_by, pagination_params: pagination_params)
end
- def tags_sorted_by(value)
- return raw_repository.tags(sort_by: value) if Feature.enabled?(:tags_finder_gitaly, project, default_enabled: :yaml)
-
- tags_ruby_sort(value)
+ def tags_sorted_by(value, pagination_params = nil)
+ raw_repository.tags(sort_by: value, pagination_params: pagination_params)
end
# Params:
@@ -1091,6 +1089,13 @@ class Repository
after_create
true
+ rescue Gitlab::Git::Repository::RepositoryExists
+ # We do not want to call `#after_create` given that we didn't create the
+ # repo, but we obviously have a mismatch between what's in our exists cache
+ # and actual on-disk state as seen by Gitaly. Let's thus expire our caches.
+ expire_status_cache
+
+ nil
end
def create_from_bundle(bundle_path)
@@ -1163,34 +1168,6 @@ class Repository
@request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore)
end
- # Deprecated: https://gitlab.com/gitlab-org/gitlab/-/issues/339741
- def tags_ruby_sort(value)
- case value
- when 'name_asc'
- VersionSorter.sort(tags) { |tag| tag.name }
- when 'name_desc'
- VersionSorter.rsort(tags) { |tag| tag.name }
- when 'updated_desc'
- tags_sorted_by_committed_date.reverse
- when 'updated_asc'
- tags_sorted_by_committed_date
- else
- tags
- end
- end
-
- # Deprecated: https://gitlab.com/gitlab-org/gitlab/-/issues/339741
- def tags_sorted_by_committed_date
- # Annotated tags can point to any object (e.g. a blob), but generally
- # tags point to a commit. If we don't have a commit, then just default
- # to putting the tag at the end of the list.
- default = Time.current
-
- tags.sort_by do |tag|
- tag.dereferenced_target&.committed_date || default
- end
- end
-
def repository_event(event, tags = {})
Gitlab::Metrics.add_event(event, tags)
end