diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /app/models/repository.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 911cfc7db38..48e96d4c193 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -149,7 +149,8 @@ class Repository before: opts[:before], all: !!opts[:all], first_parent: !!opts[:first_parent], - order: opts[:order] + order: opts[:order], + literal_pathspec: opts.fetch(:literal_pathspec, true) } commits = Gitlab::Git::Commit.where(options) @@ -676,24 +677,24 @@ class Repository end end - def list_last_commits_for_tree(sha, path, offset: 0, limit: 25) - commits = raw_repository.list_last_commits_for_tree(sha, path, offset: offset, limit: limit) + def list_last_commits_for_tree(sha, path, offset: 0, limit: 25, literal_pathspec: false) + commits = raw_repository.list_last_commits_for_tree(sha, path, offset: offset, limit: limit, literal_pathspec: literal_pathspec) commits.each do |path, commit| commits[path] = ::Commit.new(commit, container) end end - def last_commit_for_path(sha, path) - commit = raw_repository.last_commit_for_path(sha, path) + def last_commit_for_path(sha, path, literal_pathspec: false) + commit = raw_repository.last_commit_for_path(sha, path, literal_pathspec: literal_pathspec) ::Commit.new(commit, container) if commit end - def last_commit_id_for_path(sha, path) + def last_commit_id_for_path(sha, path, literal_pathspec: false) key = path.blank? ? "last_commit_id_for_path:#{sha}" : "last_commit_id_for_path:#{sha}:#{Digest::SHA1.hexdigest(path)}" cache.fetch(key) do - last_commit_for_path(sha, path)&.id + last_commit_for_path(sha, path, literal_pathspec: literal_pathspec)&.id end end @@ -712,8 +713,8 @@ class Repository "#{name}-#{highest_branch_id + 1}" end - def branches_sorted_by(value) - raw_repository.local_branches(sort_by: value) + def branches_sorted_by(sort_by, pagination_params = nil) + raw_repository.local_branches(sort_by: sort_by, pagination_params: pagination_params) end def tags_sorted_by(value) @@ -1113,7 +1114,7 @@ class Repository def project if repo_type.snippet? container.project - else + elsif container.is_a?(Project) container end end |