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
a02881df
Commit
a02881df
authored
Sep 26, 2017
by
Zeger-Jan van de Weg
Committed by
Alejandro Rodríguez
Sep 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RepositoryExists is always called with #gitaly_migration
parent
cae34173
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
19 deletions
+18
-19
app/models/repository.rb
app/models/repository.rb
+1
-17
changelogs/unreleased/zj-repo-gitaly.yml
changelogs/unreleased/zj-repo-gitaly.yml
+5
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+12
-2
No files found.
app/models/repository.rb
View file @
a02881df
...
@@ -489,13 +489,7 @@ class Repository
...
@@ -489,13 +489,7 @@ class Repository
def
exists?
def
exists?
return
false
unless
full_path
return
false
unless
full_path
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
)
do
|
enabled
|
if
enabled
raw_repository
.
exists?
raw_repository
.
exists?
else
refs_directory_exists?
end
end
end
end
cache_method
:exists?
cache_method
:exists?
...
@@ -1063,12 +1057,6 @@ class Repository
...
@@ -1063,12 +1057,6 @@ class Repository
blob
.
data
blob
.
data
end
end
def
refs_directory_exists?
circuit_breaker
.
perform
do
File
.
exist?
(
File
.
join
(
path_to_repo
,
'refs'
))
end
end
def
cache
def
cache
# TODO: should we use UUIDs here? We could move repositories without clearing this cache
# TODO: should we use UUIDs here? We could move repositories without clearing this cache
@cache
||=
RepositoryCache
.
new
(
full_path
,
@project
.
id
)
@cache
||=
RepositoryCache
.
new
(
full_path
,
@project
.
id
)
...
@@ -1120,10 +1108,6 @@ class Repository
...
@@ -1120,10 +1108,6 @@ class Repository
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
,
Gitlab
::
GlRepository
.
gl_repository
(
project
,
false
))
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
disk_path
+
'.git'
,
Gitlab
::
GlRepository
.
gl_repository
(
project
,
false
))
end
end
def
circuit_breaker
@circuit_breaker
||=
Gitlab
::
Git
::
Storage
::
CircuitBreaker
.
for_storage
(
project
.
repository_storage
)
end
def
find_commits_by_message_by_shelling_out
(
query
,
ref
,
path
,
limit
,
offset
)
def
find_commits_by_message_by_shelling_out
(
query
,
ref
,
path
,
limit
,
offset
)
ref
||=
root_ref
ref
||=
root_ref
...
...
changelogs/unreleased/zj-repo-gitaly.yml
0 → 100644
View file @
a02881df
---
title
:
Gitaly RepositoryExists remains opt-in for all method calls
merge_request
:
author
:
type
:
fixed
lib/gitlab/git/repository.rb
View file @
a02881df
...
@@ -73,8 +73,6 @@ module Gitlab
...
@@ -73,8 +73,6 @@ module Gitlab
delegate
:empty?
,
delegate
:empty?
,
to: :rugged
to: :rugged
delegate
:exists?
,
to: :gitaly_repository_client
def
==
(
other
)
def
==
(
other
)
path
==
other
.
path
path
==
other
.
path
end
end
...
@@ -102,6 +100,18 @@ module Gitlab
...
@@ -102,6 +100,18 @@ module Gitlab
@circuit_breaker
||=
Gitlab
::
Git
::
Storage
::
CircuitBreaker
.
for_storage
(
storage
)
@circuit_breaker
||=
Gitlab
::
Git
::
Storage
::
CircuitBreaker
.
for_storage
(
storage
)
end
end
def
exists?
Gitlab
::
GitalyClient
.
migrate
(
:repository_exists
)
do
|
enabled
|
if
enabled
gitaly_repository_client
.
exists?
else
circuit_breaker
.
perform
do
File
.
exist?
(
File
.
join
(
@path
,
'refs'
))
end
end
end
end
# Returns an Array of branch names
# Returns an Array of branch names
# sorted by name ASC
# sorted by name ASC
def
branch_names
def
branch_names
...
...
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