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
e7ef9133
Commit
e7ef9133
authored
Jun 01, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify server feature flags
parent
f131757f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-3
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+6
-12
No files found.
lib/gitlab/git/commit.rb
View file @
e7ef9133
...
@@ -60,9 +60,7 @@ module Gitlab
...
@@ -60,9 +60,7 @@ module Gitlab
# Some weird thing?
# Some weird thing?
return
nil
unless
commit_id
.
is_a?
(
String
)
return
nil
unless
commit_id
.
is_a?
(
String
)
# The Go-Git backend Gitaly might use, tries to be nice when resolving
# This saves us an RPC round trip.
# to the commit, and `master:ref` will resolve to the commit that master
# resolves to. To keep behaviour the same, we return nil
return
nil
if
commit_id
.
include?
(
':'
)
return
nil
if
commit_id
.
include?
(
':'
)
commit
=
repo
.
gitaly_migrate
(
:find_commit
)
do
|
is_enabled
|
commit
=
repo
.
gitaly_migrate
(
:find_commit
)
do
|
is_enabled
|
...
...
lib/gitlab/gitaly_client.rb
View file @
e7ef9133
...
@@ -191,7 +191,7 @@ module Gitlab
...
@@ -191,7 +191,7 @@ module Gitlab
metadata
[
'call_site'
]
=
feature
.
to_s
if
feature
metadata
[
'call_site'
]
=
feature
.
to_s
if
feature
metadata
[
'gitaly-servers'
]
=
address_metadata
(
remote_storage
)
if
remote_storage
metadata
[
'gitaly-servers'
]
=
address_metadata
(
remote_storage
)
if
remote_storage
metadata
.
merge!
(
server_feature_flags
(
feature
)
)
metadata
.
merge!
(
server_feature_flags
)
result
=
{
metadata:
metadata
}
result
=
{
metadata:
metadata
}
...
@@ -211,18 +211,12 @@ module Gitlab
...
@@ -211,18 +211,12 @@ module Gitlab
result
result
end
end
SERVER_FEATURE_FLAGS
=
{
SERVER_FEATURE_FLAGS
=
%w[gogit_findcommit]
.
freeze
find_commit:
[
"gogit-findcommit"
]
}.
freeze
# Other than data on the disk, Gitaly is stateless. Rails will thus set
def
self
.
server_feature_flags
# feature flags in the request metadata.
SERVER_FEATURE_FLAGS
.
map
do
|
f
|
def
self
.
server_feature_flags
(
feature
)
[
"gitaly-feature-
#{
f
.
tr
(
'_'
,
'-'
)
}
"
,
feature_enabled?
(
f
).
to_s
]
return
{}
unless
SERVER_FEATURE_FLAGS
.
key?
(
feature
)
end
.
to_h
SERVER_FEATURE_FLAGS
[
feature
]
.
map
{
|
f
|
[
"gitaly-feature-
#{
f
}
"
,
feature_enabled?
(
f
).
to_s
]
}
.
to_h
end
end
def
self
.
token
(
storage
)
def
self
.
token
(
storage
)
...
...
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