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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
be5e6d58
Commit
be5e6d58
authored
Jun 27, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make search and message RPC's mandatory
parent
1f31803d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
50 deletions
+6
-50
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-7
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-19
lib/gitlab/git/tag.rb
lib/gitlab/git/tag.rb
+1
-12
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+2
-12
No files found.
lib/gitlab/git/commit.rb
View file @
be5e6d58
...
@@ -323,13 +323,7 @@ module Gitlab
...
@@ -323,13 +323,7 @@ module Gitlab
end
end
def
get_messages
(
repository
,
commit_ids
)
def
get_messages
(
repository
,
commit_ids
)
repository
.
gitaly_migrate
(
:commit_messages
)
do
|
is_enabled
|
if
is_enabled
repository
.
gitaly_commit_client
.
get_commit_messages
(
commit_ids
)
repository
.
gitaly_commit_client
.
get_commit_messages
(
commit_ids
)
else
commit_ids
.
map
{
|
id
|
[
id
,
rugged_find
(
repository
,
id
).
message
]
}.
to_h
end
end
end
end
end
end
...
...
lib/gitlab/git/repository.rb
View file @
be5e6d58
...
@@ -1316,16 +1316,7 @@ module Gitlab
...
@@ -1316,16 +1316,7 @@ module Gitlab
safe_query
=
Regexp
.
escape
(
query
)
safe_query
=
Regexp
.
escape
(
query
)
ref
||=
root_ref
ref
||=
root_ref
gitaly_migrate
(
:search_files_by_content
)
do
|
is_enabled
|
if
is_enabled
gitaly_repository_client
.
search_files_by_content
(
ref
,
safe_query
)
gitaly_repository_client
.
search_files_by_content
(
ref
,
safe_query
)
else
offset
=
2
args
=
%W(grep -i -I -n -z --before-context
#{
offset
}
--after-context
#{
offset
}
-E -e
#{
safe_query
}
#{
ref
}
)
run_git
(
args
).
first
.
scrub
.
split
(
/^--\n/
)
end
end
end
end
def
can_be_merged?
(
source_sha
,
target_branch
)
def
can_be_merged?
(
source_sha
,
target_branch
)
...
@@ -1342,15 +1333,7 @@ module Gitlab
...
@@ -1342,15 +1333,7 @@ module Gitlab
return
[]
if
empty?
||
safe_query
.
blank?
return
[]
if
empty?
||
safe_query
.
blank?
gitaly_migrate
(
:search_files_by_name
)
do
|
is_enabled
|
if
is_enabled
gitaly_repository_client
.
search_files_by_name
(
ref
,
safe_query
)
gitaly_repository_client
.
search_files_by_name
(
ref
,
safe_query
)
else
args
=
%W(ls-tree -r --name-status --full-tree
#{
ref
}
--
#{
safe_query
}
)
run_git
(
args
).
first
.
lines
.
map
(
&
:strip
)
end
end
end
end
def
find_commits_by_message
(
query
,
ref
,
path
,
limit
,
offset
)
def
find_commits_by_message
(
query
,
ref
,
path
,
limit
,
offset
)
...
...
lib/gitlab/git/tag.rb
View file @
be5e6d58
...
@@ -28,18 +28,7 @@ module Gitlab
...
@@ -28,18 +28,7 @@ module Gitlab
end
end
def
get_messages
(
repository
,
tag_ids
)
def
get_messages
(
repository
,
tag_ids
)
repository
.
gitaly_migrate
(
:tag_messages
)
do
|
is_enabled
|
if
is_enabled
repository
.
gitaly_ref_client
.
get_tag_messages
(
tag_ids
)
repository
.
gitaly_ref_client
.
get_tag_messages
(
tag_ids
)
else
tag_ids
.
map
do
|
id
|
tag
=
repository
.
rugged
.
lookup
(
id
)
message
=
tag
.
is_a?
(
Rugged
::
Commit
)
?
""
:
tag
.
message
[
id
,
message
]
end
.
to_h
end
end
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
be5e6d58
...
@@ -664,7 +664,7 @@ describe Repository do
...
@@ -664,7 +664,7 @@ describe Repository do
end
end
end
end
shared_examples
"search_files_by_content"
do
describe
"search_files_by_content"
do
let
(
:results
)
{
repository
.
search_files_by_content
(
'feature'
,
'master'
)
}
let
(
:results
)
{
repository
.
search_files_by_content
(
'feature'
,
'master'
)
}
subject
{
results
}
subject
{
results
}
...
@@ -711,7 +711,7 @@ describe Repository do
...
@@ -711,7 +711,7 @@ describe Repository do
end
end
end
end
shared_examples
"search_files_by_name"
do
describe
"search_files_by_name"
do
let
(
:results
)
{
repository
.
search_files_by_name
(
'files'
,
'master'
)
}
let
(
:results
)
{
repository
.
search_files_by_name
(
'files'
,
'master'
)
}
it
'returns result'
do
it
'returns result'
do
...
@@ -751,16 +751,6 @@ describe Repository do
...
@@ -751,16 +751,6 @@ describe Repository do
end
end
end
end
describe
'with gitaly enabled'
do
it_behaves_like
'search_files_by_content'
it_behaves_like
'search_files_by_name'
end
describe
'with gitaly disabled'
,
:disable_gitaly
do
it_behaves_like
'search_files_by_content'
it_behaves_like
'search_files_by_name'
end
describe
'#async_remove_remote'
do
describe
'#async_remove_remote'
do
before
do
before
do
masterrev
=
repository
.
find_branch
(
'master'
).
dereferenced_target
masterrev
=
repository
.
find_branch
(
'master'
).
dereferenced_target
...
...
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