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
c65b42aa
Commit
c65b42aa
authored
Aug 18, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ES] Fix for unborn head
parent
e166706a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
app/models/repository.rb
app/models/repository.rb
+4
-4
app/workers/elastic_commit_indexer_worker.rb
app/workers/elastic_commit_indexer_worker.rb
+1
-1
spec/workers/elastic_commit_indexer_worker_spec.rb
spec/workers/elastic_commit_indexer_worker_spec.rb
+9
-0
No files found.
app/models/repository.rb
View file @
c65b42aa
...
...
@@ -1248,16 +1248,16 @@ class Repository
end
end
def
head_exists?
exists?
&&
!
empty?
&&
!
rugged
.
head_unborn?
end
private
def
cache
@cache
||=
RepositoryCache
.
new
(
path_with_namespace
,
@project
.
id
)
end
def
head_exists?
exists?
&&
!
empty?
&&
!
rugged
.
head_unborn?
end
def
file_on_head
(
regex
)
tree
(
:head
).
blobs
.
find
{
|
file
|
file
.
name
=~
regex
}
end
...
...
app/workers/elastic_commit_indexer_worker.rb
View file @
c65b42aa
...
...
@@ -7,7 +7,7 @@ class ElasticCommitIndexerWorker
project
=
Project
.
find
(
project_id
)
repository
=
project
.
repository
return
true
unless
repository
.
exists?
&&
!
repository
.
empty
?
return
true
unless
repository
.
head_exists
?
indexer
=
Gitlab
::
Elastic
::
Indexer
.
new
indexer
.
run
(
...
...
spec/workers/elastic_commit_indexer_worker_spec.rb
View file @
c65b42aa
...
...
@@ -18,5 +18,14 @@ describe ElasticCommitIndexerWorker do
subject
.
perform
(
empty_project
.
id
,
'0000'
,
'0000'
)
end
it
'returns true if repository has unborn head'
do
project
=
create
:project
rugged
=
double
(
'rugged'
)
expect
(
rugged
).
to
receive
(
:head_unborn?
).
and_return
(
true
)
expect_any_instance_of
(
Repository
).
to
receive
(
:rugged
).
and_return
(
rugged
)
expect
(
subject
.
perform
(
project
.
id
)).
to
be_truthy
end
end
end
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