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
Show 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
...
@@ -139,6 +139,7 @@ class Repository
repo:
raw_repository
,
repo:
raw_repository
,
ref:
ref
,
ref:
ref
,
path:
opts
[
:path
],
path:
opts
[
:path
],
author:
opts
[
:author
],
follow:
Array
(
opts
[
:path
]).
length
==
1
,
follow:
Array
(
opts
[
:path
]).
length
==
1
,
limit:
opts
[
:limit
],
limit:
opts
[
:limit
],
offset:
opts
[
:offset
],
offset:
opts
[
:offset
],
...
...
lib/gitlab/git/repository.rb
View file @
9e9a2cc9
...
@@ -322,6 +322,7 @@ module Gitlab
...
@@ -322,6 +322,7 @@ module Gitlab
limit:
10
,
limit:
10
,
offset:
0
,
offset:
0
,
path:
nil
,
path:
nil
,
author:
nil
,
follow:
false
,
follow:
false
,
skip_merges:
false
,
skip_merges:
false
,
after:
nil
,
after:
nil
,
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
9e9a2cc9
...
@@ -324,6 +324,7 @@ module Gitlab
...
@@ -324,6 +324,7 @@ module Gitlab
request
.
after
=
GitalyClient
.
timestamp
(
options
[
:after
])
if
options
[
:after
]
request
.
after
=
GitalyClient
.
timestamp
(
options
[
:after
])
if
options
[
:after
]
request
.
before
=
GitalyClient
.
timestamp
(
options
[
:before
])
if
options
[
:before
]
request
.
before
=
GitalyClient
.
timestamp
(
options
[
:before
])
if
options
[
:before
]
request
.
revision
=
encode_binary
(
options
[
:ref
])
if
options
[
:ref
]
request
.
revision
=
encode_binary
(
options
[
:ref
])
if
options
[
:ref
]
request
.
author
=
encode_binary
(
options
[
:author
])
if
options
[
:author
]
request
.
order
=
options
[
:order
].
upcase
.
sub
(
'DEFAULT'
,
'NONE'
)
if
options
[
:order
].
present?
request
.
order
=
options
[
:order
].
upcase
.
sub
(
'DEFAULT'
,
'NONE'
)
if
options
[
:order
].
present?
request
.
paths
=
encode_repeated
(
Array
(
options
[
:path
]))
if
options
[
:path
].
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
...
@@ -306,5 +306,19 @@ describe Gitlab::GitalyClient::CommitService do
client
.
find_commits
(
order:
'topo'
)
client
.
find_commits
(
order:
'topo'
)
end
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
end
end
spec/models/repository_spec.rb
View file @
9e9a2cc9
...
@@ -320,6 +320,20 @@ describe Repository do
...
@@ -320,6 +320,20 @@ describe Repository do
end
end
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
context
"when 'all' flag is set"
do
it
'returns every commit from the repository'
do
it
'returns every commit from the repository'
do
expect
(
repository
.
commits
(
nil
,
all:
true
,
limit:
60
).
size
).
to
eq
(
60
)
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