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
b5046855
Commit
b5046855
authored
Feb 04, 2019
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed text? method in ElasticSearch module to text_in_repo?
parent
84ac9253
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
5 deletions
+24
-5
ee/changelogs/unreleased/fj-regressing-blob-text-in-repo-method.yml
...ogs/unreleased/fj-regressing-blob-text-in-repo-method.yml
+5
-0
ee/lib/elasticsearch/git/lite_blob.rb
ee/lib/elasticsearch/git/lite_blob.rb
+1
-1
ee/lib/elasticsearch/git/repository.rb
ee/lib/elasticsearch/git/repository.rb
+3
-4
ee/spec/models/concerns/elastic/repository_spec.rb
ee/spec/models/concerns/elastic/repository_spec.rb
+15
-0
No files found.
ee/changelogs/unreleased/fj-regressing-blob-text-in-repo-method.yml
0 → 100644
View file @
b5046855
---
title
:
Replacing old blob methods in ElasticSerach module
merge_request
:
9418
author
:
type
:
fixed
ee/lib/elasticsearch/git/lite_blob.rb
View file @
b5046855
...
...
@@ -13,7 +13,7 @@ module Elasticsearch
@id
=
raw_blob_hash
[
:oid
]
@blob
=
repo
.
lookup
(
@id
)
@mode
=
raw_blob_hash
[
:mode
]
.
to_s
(
8
)
@mode
=
(
raw_blob_hash
[
:mode
]
||
raw_blob_hash
[
:filemode
])
.
to_s
(
8
)
@size
=
@blob
.
size
@path
=
encode!
(
raw_blob_hash
[
:path
])
@name
=
@path
.
split
(
'/'
).
last
...
...
ee/lib/elasticsearch/git/repository.rb
View file @
b5046855
...
...
@@ -74,7 +74,7 @@ module Elasticsearch
end
def
delete_blob
(
blob
)
return
unless
blob
.
text?
return
unless
blob
.
text
_in_repo
?
{
delete:
{
...
...
@@ -246,7 +246,6 @@ module Elasticsearch
result
=
[]
target_sha
=
repository_for_indexing
.
head
.
target
.
oid
if
repository_for_indexing
.
bare?
tree
=
repository_for_indexing
.
lookup
(
target_sha
).
tree
result
.
push
(
recurse_blobs_index_hash
(
tree
))
...
...
@@ -254,7 +253,7 @@ module Elasticsearch
repository_for_indexing
.
index
.
each
do
|
blob
|
b
=
LiteBlob
.
new
(
repository_for_indexing
,
blob
)
if
b
.
text?
if
b
.
text
_in_repo
?
result
.
push
(
{
id:
"
#{
target_sha
}
_
#{
b
.
path
}
"
,
...
...
@@ -277,7 +276,7 @@ module Elasticsearch
blob
[
:path
]
=
path
+
blob
[
:name
]
b
=
LiteBlob
.
new
(
repository_for_indexing
,
blob
)
if
b
.
text?
if
b
.
text
_in_repo
?
result
.
push
(
{
id:
"
#{
repository_for_indexing
.
head
.
target
.
oid
}
_
#{
path
}#{
blob
[
:name
]
}
"
,
...
...
ee/spec/models/concerns/elastic/repository_spec.rb
View file @
b5046855
...
...
@@ -32,6 +32,21 @@ describe Repository, :elastic do
expect
(
project
.
repository
.
search
(
'def | popen extension:md'
)[
:blobs
][
:total_count
]).
to
eq
(
1
)
end
it
'can delete blobs'
do
project
=
create
:project
,
:repository
blob
=
project
.
repository
.
blob_at
(
'b83d6e391c22777fca1ed3012fce84f633d7fed0'
,
'files/ruby/popen.rb'
)
expect
(
project
.
repository
.
delete_blob
(
blob
)[
:delete
]).
not_to
be_empty
end
it
'can return the index as a json'
do
project
=
create
:project
,
:repository
index
=
project
.
repository
.
as_indexed_json
expect
(
index
[
:blobs
]).
not_to
be_empty
expect
(
index
[
:commits
]).
not_to
be_empty
end
def
search_and_check!
(
on
,
query
,
type
:,
per:
1000
)
results
=
on
.
search
(
query
,
type:
type
,
per:
per
)[
"
#{
type
}
s"
.
to_sym
][
:results
]
...
...
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