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>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /lib/api/commits.rb
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r--lib/api/commits.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index fa99a1a2bc8..a4e1e8308c3 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -9,7 +9,7 @@ module API
before do
require_repository_enabled!
- authorize! :read_code, user_project
+ authorize_read_code!
verify_pagination_params!
end
@@ -20,6 +20,8 @@ module API
end
def authorize_push_to_branch!(branch)
+ authenticate!
+
unless user_access.can_push_to_branch?(branch)
forbidden!("You are not allowed to push into this branch")
end
@@ -32,8 +34,6 @@ module API
Gitlab::UsageDataCounters::EditorUniqueCounter.track_web_ide_edit_action(author: current_user, project: user_project)
namespace = user_project.namespace
- return unless Feature.enabled?(:route_hll_to_snowplow_phase3, namespace)
-
Gitlab::Tracking.event(
'API::Commits',
:commit,
@@ -76,6 +76,10 @@ module API
type: String,
desc: 'The file path',
documentation: { example: 'README.md' }
+ optional :author,
+ type: String,
+ desc: 'Search commits by commit author',
+ documentation: { example: 'John Smith' }
optional :all, type: Boolean, desc: 'Every commit will be returned'
optional :with_stats, type: Boolean, desc: 'Stats about each commit will be added to the response'
optional :first_parent, type: Boolean, desc: 'Only include the first parent of merges'
@@ -99,6 +103,7 @@ module API
with_stats = params[:with_stats]
first_parent = params[:first_parent]
order = params[:order]
+ author = params[:author]
commits = user_project.repository.commits(ref,
path: path,
@@ -109,6 +114,7 @@ module API
all: all,
first_parent: first_parent,
order: order,
+ author: author,
trailers: params[:trailers])
serializer = with_stats ? Entities::CommitWithStats : Entities::Commit
@@ -127,6 +133,8 @@ module API
tags %w[commits]
failure [
{ code: 400, message: 'Bad request' },
+ { code: 401, message: 'Unauthorized' },
+ { code: 403, message: 'Forbidden' },
{ code: 404, message: 'Not found' }
]
detail 'This feature was introduced in GitLab 8.13'