BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
146d4348
Commit
146d4348
authored
Oct 24, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'luishgo/gitlab-ce-18898-filter-commits-per-path'
See merge request !4814.
parents
d04ce833
f73d83db
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
commits.rb
lib/api/commits.rb
+2
-0
commits_spec.rb
spec/requests/api/commits_spec.rb
+11
-0
No files found.
CHANGELOG.md
View file @
146d4348
...
...
@@ -4,6 +4,7 @@ Please view this file on the master branch, on stable branches it's out of date.
-
Adds user project membership expired event to clarify why user was removed (Callum Dryden)
-
Trim leading and trailing whitespace on project_path (Linus Thiel)
-
Prevent award emoji via notes for issues/MRs authored by user (barthc)
-
Adds an optional path parameter to the Commits API to filter commits by path (Luis HGO)
-
Fix HipChat notifications rendering (airatshigapov, eisnerd)
-
Add hover to trash icon in notes !7008 (blackst0ne)
-
Simpler arguments passed to named_route on toggle_award_url helper method
...
...
lib/api/commits.rb
View file @
146d4348
...
...
@@ -19,6 +19,7 @@ module API
optional
:until
,
type:
String
,
desc:
'Only commits before or in this date will be returned'
optional
:page
,
type:
Integer
,
default:
0
,
desc:
'The page for pagination'
optional
:per_page
,
type:
Integer
,
default:
20
,
desc:
'The number of results per page'
optional
:path
,
type:
String
,
desc:
'The file path'
end
get
":id/repository/commits"
do
# TODO remove the next line for 9.0, use DateTime type in the params block
...
...
@@ -28,6 +29,7 @@ module API
offset
=
params
[
:page
]
*
params
[
:per_page
]
commits
=
user_project
.
repository
.
commits
(
ref
,
path:
params
[
:path
],
limit:
params
[
:per_page
],
offset:
offset
,
after:
params
[
:since
],
...
...
spec/requests/api/commits_spec.rb
View file @
146d4348
...
...
@@ -72,6 +72,17 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
]).
to
include
"
\"
since
\"
must be a timestamp in ISO 8601 format"
end
end
context
"path optional parameter"
do
it
"returns project commits matching provided path parameter"
do
path
=
'files/ruby/popen.rb'
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits?path=
#{
path
}
"
,
user
)
expect
(
json_response
.
size
).
to
eq
(
3
)
expect
(
json_response
.
first
[
"id"
]).
to
eq
(
"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
)
end
end
end
describe
"Create a commit with multiple files and actions"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment