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
096cf2aa
Commit
096cf2aa
authored
Apr 17, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
c6b31cd2
6a72ab22
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
2 deletions
+64
-2
changelogs/unreleased/sh-backport-list-commits-by-oid-rugged.yml
...ogs/unreleased/sh-backport-list-commits-by-oid-rugged.yml
+5
-0
doc/development/gitaly.md
doc/development/gitaly.md
+2
-0
lib/gitlab/git/rugged_impl/commit.rb
lib/gitlab/git/rugged_impl/commit.rb
+20
-0
lib/gitlab/git/rugged_impl/repository.rb
lib/gitlab/git/rugged_impl/repository.rb
+1
-1
spec/lib/gitlab/git/commit_spec.rb
spec/lib/gitlab/git/commit_spec.rb
+36
-1
No files found.
changelogs/unreleased/sh-backport-list-commits-by-oid-rugged.yml
0 → 100644
View file @
096cf2aa
---
title
:
Bring back Rugged implementation of ListCommitsByOid
merge_request
:
27441
author
:
type
:
performance
doc/development/gitaly.md
View file @
096cf2aa
...
...
@@ -80,6 +80,8 @@ most commonly-used RPCs can be enabled via feature flags:
*
`rugged_get_tree_entries`
*
`rugged_tree_entry`
*
`rugged_commit_is_ancestor`
*
`rugged_commit_tree_entry`
*
`rugged_list_commits_by_oid`
A convenience Rake task can be used to enable or disable these flags
all together. To enable:
...
...
lib/gitlab/git/rugged_impl/commit.rb
View file @
096cf2aa
...
...
@@ -21,6 +21,17 @@ module Gitlab
nil
end
# This needs to return an array of Gitlab::Git:Commit objects
# instead of Rugged::Commit objects to ensure upstream models
# operate on a consistent interface. Unlike
# Gitlab::Git::Commit.find, Gitlab::Git::Commit.batch_by_oid
# doesn't attempt to decorate the result.
def
rugged_batch_by_oid
(
repo
,
oids
)
oids
.
map
{
|
oid
|
rugged_find
(
repo
,
oid
)
}
.
compact
.
map
{
|
commit
|
decorate
(
repo
,
commit
)
}
end
override
:find_commit
def
find_commit
(
repo
,
commit_id
)
if
Feature
.
enabled?
(
:rugged_find_commit
)
...
...
@@ -29,6 +40,15 @@ module Gitlab
super
end
end
override
:batch_by_oid
def
batch_by_oid
(
repo
,
oids
)
if
Feature
.
enabled?
(
:rugged_list_commits_by_oid
)
rugged_batch_by_oid
(
repo
,
oids
)
else
super
end
end
end
extend
::
Gitlab
::
Utils
::
Override
...
...
lib/gitlab/git/rugged_impl/repository.rb
View file @
096cf2aa
...
...
@@ -12,7 +12,7 @@ module Gitlab
module
Repository
extend
::
Gitlab
::
Utils
::
Override
FEATURE_FLAGS
=
%i(rugged_find_commit rugged_tree_entries rugged_tree_entry rugged_commit_is_ancestor rugged_commit_tree_entry)
.
freeze
FEATURE_FLAGS
=
%i(rugged_find_commit rugged_tree_entries rugged_tree_entry rugged_commit_is_ancestor rugged_commit_tree_entry
rugged_list_commits_by_oid
)
.
freeze
def
alternate_object_directories
relative_object_directories
.
map
{
|
d
|
File
.
join
(
path
,
d
)
}
...
...
spec/lib/gitlab/git/commit_spec.rb
View file @
096cf2aa
...
...
@@ -380,7 +380,32 @@ describe Gitlab::Git::Commit, :seed_helper do
end
end
describe
'#batch_by_oid'
do
shared_examples
'.batch_by_oid'
do
context
'with multiple OIDs'
do
let
(
:oids
)
{
[
SeedRepo
::
Commit
::
ID
,
SeedRepo
::
FirstCommit
::
ID
]
}
it
'returns multiple commits'
do
commits
=
described_class
.
batch_by_oid
(
repository
,
oids
)
expect
(
commits
.
count
).
to
eq
(
2
)
expect
(
commits
).
to
all
(
be_a
(
Gitlab
::
Git
::
Commit
)
)
expect
(
commits
.
first
.
sha
).
to
eq
(
SeedRepo
::
Commit
::
ID
)
expect
(
commits
.
second
.
sha
).
to
eq
(
SeedRepo
::
FirstCommit
::
ID
)
end
end
context
'when oids is empty'
do
it
'returns empty commits'
do
commits
=
described_class
.
batch_by_oid
(
repository
,
[])
expect
(
commits
.
count
).
to
eq
(
0
)
end
end
end
describe
'.batch_by_oid with Gitaly enabled'
do
it_should_behave_like
'.batch_by_oid'
context
'when oids is empty'
do
it
'makes no Gitaly request'
do
expect
(
Gitlab
::
GitalyClient
).
not_to
receive
(
:call
)
...
...
@@ -390,6 +415,16 @@ describe Gitlab::Git::Commit, :seed_helper do
end
end
describe
'.batch_by_oid with Rugged enabled'
,
:enable_rugged
do
it_should_behave_like
'.batch_by_oid'
it
'calls out to the Rugged implementation'
do
allow_any_instance_of
(
Rugged
).
to
receive
(
:rev_parse
).
with
(
SeedRepo
::
Commit
::
ID
).
and_call_original
described_class
.
batch_by_oid
(
repository
,
[
SeedRepo
::
Commit
::
ID
])
end
end
shared_examples
'extracting commit signature'
do
context
'when the commit is signed'
do
let
(
:commit_id
)
{
'0b4bc9a49b562e85de7cc9e834518ea6828729b9'
}
...
...
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