Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
8139fe23
Commit
8139fe23
authored
Jul 27, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use git_config_options instead of git_config_parameters for Gitaly requests
parent
5c2fee4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+10
-7
spec/gitlab_shell_spec.rb
spec/gitlab_shell_spec.rb
+12
-0
No files found.
lib/gitlab_shell.rb
View file @
8139fe23
...
...
@@ -16,6 +16,9 @@ class GitlabShell
}
API_COMMANDS
=
%w(2fa_recovery_codes)
GL_PROTOCOL
=
'ssh'
.
freeze
# We have to use a negative transfer.hideRefs since this is the only way
# to undo an already set parameter: https://www.spinics.net/lists/git/msg256772.html
GIT_CONFIG_SHOW_ALL_REFS
=
"transfer.hideRefs=!refs"
.
freeze
attr_accessor
:key_id
,
:gl_repository
,
:repo_name
,
:command
,
:git_access
,
:show_all_refs
attr_reader
:repo_path
...
...
@@ -124,13 +127,15 @@ class GitlabShell
# The entire gitaly_request hash should be built in gitlab-ce and passed
# on as-is. For now we build a fake one on the spot.
gitaly_request
=
JSON
.
dump
(
{
gitaly_request
=
{
'repository'
=>
@gitaly
[
'repository'
],
'gl_repository'
=>
@gl_repository
,
'gl_id'
=>
@key_id
,
})
'gl_id'
=>
@key_id
}
gitaly_request
[
'git_config_options'
]
=
[
GIT_CONFIG_SHOW_ALL_REFS
]
if
@show_all_refs
args
=
[
gitaly_address
,
gitaly_request
]
args
=
[
gitaly_address
,
JSON
.
dump
(
gitaly_request
)
]
end
args_string
=
[
File
.
basename
(
executable
),
*
args
].
join
(
' '
)
...
...
@@ -160,9 +165,7 @@ class GitlabShell
env
[
'GITALY_TOKEN'
]
=
@gitaly
[
'token'
]
end
# We have to use a negative transfer.hideRefs since this is the only way
# to undo an already set parameter: https://www.spinics.net/lists/git/msg256772.html
env
[
'GIT_CONFIG_PARAMETERS'
]
=
"'transfer.hideRefs=!refs'"
if
@show_all_refs
env
[
'GIT_CONFIG_PARAMETERS'
]
=
"'
#{
GIT_CONFIG_SHOW_ALL_REFS
}
'"
if
@show_all_refs
if
git_trace_available?
env
.
merge!
({
...
...
spec/gitlab_shell_spec.rb
View file @
8139fe23
...
...
@@ -157,6 +157,18 @@ describe GitlabShell do
end
end
context
'gitaly-upload-pack with GeoNode'
do
let
(
:ssh_cmd
)
{
"git-upload-pack gitlab-ci.git"
}
let
(
:gitaly_check_access_with_geo
)
{
GitAccessStatus
.
new
(
true
,
'ok'
,
gl_repository
,
repo_path
,
{
'repository'
=>
{
'relative_path'
=>
repo_name
,
'storage_name'
=>
'default'
}
,
'address'
=>
'unix:gitaly.socket'
},
true
)
}
let
(
:gitaly_message_with_all_refs
)
{
JSON
.
dump
({
'repository'
=>
{
'relative_path'
=>
repo_name
,
'storage_name'
=>
'default'
},
'gl_repository'
=>
gl_repository
,
'gl_id'
=>
key_id
,
'git_config_options'
=>
[
GitlabShell
::
GIT_CONFIG_SHOW_ALL_REFS
]})
}
before
{
api
.
stub
(
check_access:
gitaly_check_access_with_geo
)
}
after
{
subject
.
exec
(
ssh_cmd
)
}
it
"should execute the command with unhiding refs"
do
subject
.
should_receive
(
:exec_cmd
).
with
(
File
.
join
(
ROOT_PATH
,
"bin/gitaly-upload-pack"
),
'unix:gitaly.socket'
,
gitaly_message_with_all_refs
)
end
end
context
'gitaly-upload-pack'
do
let
(
:ssh_cmd
)
{
"git-upload-pack gitlab-ci.git"
}
before
{
...
...
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