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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-17 15:11:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-17 15:11:55 +0300
commitc609c898ff7f42c3d72a1c6d619e1ff786f5e18a (patch)
tree8886ffa1ab9e2eb176f66209dd1c34ee1ecba3ea /app/finders/tags_finder.rb
parentb1a7b1b7e33ae747119d89e5a6697b361df4d947 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders/tags_finder.rb')
-rw-r--r--app/finders/tags_finder.rb31
1 files changed, 29 insertions, 2 deletions
diff --git a/app/finders/tags_finder.rb b/app/finders/tags_finder.rb
index 36ca2c7f281..6bc5419e704 100644
--- a/app/finders/tags_finder.rb
+++ b/app/finders/tags_finder.rb
@@ -5,9 +5,36 @@ class TagsFinder < GitRefsFinder
super(repository, params)
end
- def execute
- tags = repository.tags_sorted_by(sort)
+ def execute(gitaly_pagination: false)
+ tags = if gitaly_pagination
+ repository.tags_sorted_by(sort, pagination_params)
+ else
+ repository.tags_sorted_by(sort)
+ end
by_search(tags)
+
+ rescue ArgumentError => e
+ raise Gitlab::Git::InvalidPageToken, "Invalid page token: #{page_token}" if e.message.include?('page token')
+
+ raise
+ end
+
+ def total
+ repository.tag_count
+ end
+
+ private
+
+ def per_page
+ params[:per_page].presence
+ end
+
+ def page_token
+ "#{Gitlab::Git::TAG_REF_PREFIX}#{@params[:page_token]}" if params[:page_token]
+ end
+
+ def pagination_params
+ { limit: per_page, page_token: page_token }
end
end