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
f3b83553
Commit
f3b83553
authored
May 04, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make gitaly executable mapping clearer
parent
2a163a17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+12
-8
No files found.
lib/gitlab_shell.rb
View file @
f3b83553
...
@@ -10,7 +10,10 @@ class GitlabShell
...
@@ -10,7 +10,10 @@ class GitlabShell
class
InvalidRepositoryPathError
<
StandardError
;
end
class
InvalidRepositoryPathError
<
StandardError
;
end
GIT_COMMANDS
=
%w(git-upload-pack git-receive-pack git-upload-archive git-lfs-authenticate)
.
freeze
GIT_COMMANDS
=
%w(git-upload-pack git-receive-pack git-upload-archive git-lfs-authenticate)
.
freeze
GITALY_MIGRATED_COMMANDS
=
%w(git-upload-pack git-receive-pack)
GITALY_MIGRATED_COMMANDS
=
{
'git-upload-pack'
=>
File
.
join
(
ROOT_PATH
,
'bin'
,
'gitaly-upload-pack'
),
'git-receive-pack'
=>
File
.
join
(
ROOT_PATH
,
'bin'
,
'gitaly-receive-pack'
),
}
API_COMMANDS
=
%w(2fa_recovery_codes)
API_COMMANDS
=
%w(2fa_recovery_codes)
GL_PROTOCOL
=
'ssh'
.
freeze
GL_PROTOCOL
=
'ssh'
.
freeze
...
@@ -109,26 +112,27 @@ class GitlabShell
...
@@ -109,26 +112,27 @@ class GitlabShell
return
return
end
end
args
=
[
@command
,
repo_path
]
executable
=
@command
args
=
[
repo_path
]
if
GITALY_MIGRATED_COMMANDS
.
include?
(
args
[
0
]
)
if
GITALY_MIGRATED_COMMANDS
.
has_key?
(
executable
)
executable
=
args
[
0
].
sub
(
'git'
,
File
.
join
(
ROOT_PATH
,
'bin/gitaly'
))
executable
=
GITALY_MIGRATED_COMMANDS
[
executable
]
gitaly_address
=
''
# would be returned by gitlab-rails internal API
gitaly_address
=
''
# would be returned by gitlab-rails internal API
# The entire gitaly_request hash should be built in gitlab-ce and passed
# 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.
# on as-is. For now we build a fake one on the spot.
gitaly_request
=
JSON
.
dump
({
gitaly_request
=
JSON
.
dump
({
'repository'
=>
{
'path'
=>
args
[
1
]
},
'repository'
=>
{
'path'
=>
repo_path
},
'gl_id'
=>
@key_id
,
'gl_id'
=>
@key_id
,
})
})
args
=
[
executable
,
gitaly_address
,
gitaly_request
]
args
=
[
gitaly_address
,
gitaly_request
]
end
end
args_string
=
[
File
.
basename
(
args
[
0
]),
*
args
[
1
,
args
.
length
]
].
join
(
' '
)
args_string
=
[
File
.
basename
(
executable
),
*
args
].
join
(
' '
)
$logger
.
info
"gitlab-shell: executing git command <
#{
args_string
}
> for
#{
log_username
}
."
$logger
.
info
"gitlab-shell: executing git command <
#{
args_string
}
> for
#{
log_username
}
."
exec_cmd
(
*
args
)
exec_cmd
(
executable
,
*
args
)
end
end
# This method is not covered by Rspec because it ends the current Ruby process.
# This method is not covered by Rspec because it ends the current Ruby process.
...
...
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