summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb21
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