Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9e9a2cc9
Commit
9e9a2cc9
authored
Feb 20, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return commits by author
First bit of roughing out the return of commits based on author.
parent
05f99b90
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
1 deletion
+32
-1
app/models/repository.rb
app/models/repository.rb
+1
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-0
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+2
-1
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+14
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+14
-0
No files found.
app/models/repository.rb
View file @
9e9a2cc9
...
...
@@ -139,6 +139,7 @@ class Repository
repo:
raw_repository
,
ref:
ref
,
path:
opts
[
:path
],
author:
opts
[
:author
],
follow:
Array
(
opts
[
:path
]).
length
==
1
,
limit:
opts
[
:limit
],
offset:
opts
[
:offset
],
...
...
lib/gitlab/git/repository.rb
View file @
9e9a2cc9
...
...
@@ -322,6 +322,7 @@ module Gitlab
limit:
10
,
offset:
0
,
path:
nil
,
author:
nil
,
follow:
false
,
skip_merges:
false
,
after:
nil
,
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
9e9a2cc9
...
...
@@ -324,7 +324,8 @@ module Gitlab
request
.
after
=
GitalyClient
.
timestamp
(
options
[
:after
])
if
options
[
:after
]
request
.
before
=
GitalyClient
.
timestamp
(
options
[
:before
])
if
options
[
:before
]
request
.
revision
=
encode_binary
(
options
[
:ref
])
if
options
[
:ref
]
request
.
order
=
options
[
:order
].
upcase
.
sub
(
'DEFAULT'
,
'NONE'
)
if
options
[
:order
].
present?
request
.
author
=
encode_binary
(
options
[
:author
])
if
options
[
:author
]
request
.
order
=
options
[
:order
].
upcase
.
sub
(
'DEFAULT'
,
'NONE'
)
if
options
[
:order
].
present?
request
.
paths
=
encode_repeated
(
Array
(
options
[
:path
]))
if
options
[
:path
].
present?
...
...
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
View file @
9e9a2cc9
...
...
@@ -306,5 +306,19 @@ describe Gitlab::GitalyClient::CommitService do
client
.
find_commits
(
order:
'topo'
)
end
it
'sends an RPC request with an author'
do
request
=
Gitaly
::
FindCommitsRequest
.
new
(
repository:
repository_message
,
disable_walk:
true
,
order:
'NONE'
,
author:
"Billy Baggins <bilbo@shire.com>"
)
expect_any_instance_of
(
Gitaly
::
CommitService
::
Stub
).
to
receive
(
:find_commits
)
.
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
client
.
find_commits
(
order:
'default'
,
author:
"Billy Baggins <bilbo@shire.com>"
)
end
end
end
spec/models/repository_spec.rb
View file @
9e9a2cc9
...
...
@@ -320,6 +320,20 @@ describe Repository do
end
end
context
"when 'author' is set"
do
let
(
:commit
)
{
repository
.
commits
(
nil
,
limit:
1
).
first
}
let
(
:known_author
)
{
"
#{
commit
.
author_name
}
<
#{
commit
.
author_email
}
>"
}
let
(
:unknown_author
)
{
"The Man With No Name <zapp@brannigan.com>"
}
it
"returns commits from that author"
do
expect
(
repository
.
commits
(
nil
,
author:
known_author
,
limit:
1
).
size
).
to
be
>
0
end
it
"doesn't returns commits from an unknown author"
do
expect
(
repository
.
commits
(
nil
,
author:
unknown_author
,
limit:
1
).
size
).
to
eq
(
0
)
end
end
context
"when 'all' flag is set"
do
it
'returns every commit from the repository'
do
expect
(
repository
.
commits
(
nil
,
all:
true
,
limit:
60
).
size
).
to
eq
(
60
)
...
...
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