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
341c1a20
Commit
341c1a20
authored
Feb 19, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Immediatly raise exception if git-annex is disabled
parent
b37c4d67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+25
-17
No files found.
lib/gitlab_shell.rb
View file @
341c1a20
...
@@ -50,11 +50,15 @@ class GitlabShell
...
@@ -50,11 +50,15 @@ class GitlabShell
args
=
Shellwords
.
shellwords
(
@origin_cmd
)
args
=
Shellwords
.
shellwords
(
@origin_cmd
)
@git_cmd
=
args
.
first
@git_cmd
=
args
.
first
if
@git_cmd
==
'git-annex-shell'
&&
@config
.
git_annex_enabled?
if
@git_cmd
==
'git-annex-shell'
@repo_name
=
escape_path
(
args
[
2
].
sub
(
/\A\/~\//
,
''
))
if
@config
.
git_annex_enabled?
@repo_name
=
escape_path
(
args
[
2
].
sub
(
/\A\/~\//
,
''
))
# Make sure repository has git-annex enabled
# Make sure repository has git-annex enabled
init_git_annex
(
@repo_name
)
init_git_annex
(
@repo_name
)
else
raise
DisallowedCommandError
end
else
else
raise
DisallowedCommandError
unless
args
.
count
==
2
raise
DisallowedCommandError
unless
args
.
count
==
2
@repo_name
=
escape_path
(
args
.
last
)
@repo_name
=
escape_path
(
args
.
last
)
...
@@ -68,21 +72,25 @@ class GitlabShell
...
@@ -68,21 +72,25 @@ class GitlabShell
def
process_cmd
def
process_cmd
repo_full_path
=
File
.
join
(
repos_path
,
repo_name
)
repo_full_path
=
File
.
join
(
repos_path
,
repo_name
)
if
@git_cmd
==
'git-annex-shell'
&&
@config
.
git_annex_enabled?
if
@git_cmd
==
'git-annex-shell'
args
=
Shellwords
.
shellwords
(
@origin_cmd
)
if
@config
.
git_annex_enabled?
parsed_args
=
args
=
Shellwords
.
shellwords
(
@origin_cmd
)
args
.
map
do
|
arg
|
parsed_args
=
# Convert /~/group/project.git to group/project.git
args
.
map
do
|
arg
|
# to make git annex path compatible with gitlab-shell
# Convert /~/group/project.git to group/project.git
if
arg
=~
/\A\/~\/.*\.git\Z/
# to make git annex path compatible with gitlab-shell
repo_full_path
if
arg
=~
/\A\/~\/.*\.git\Z/
else
repo_full_path
arg
else
arg
end
end
end
end
$logger
.
info
"gitlab-shell: executing git-annex command <
#{
parsed_args
.
join
(
' '
)
}
> for
#{
log_username
}
."
$logger
.
info
"gitlab-shell: executing git-annex command <
#{
parsed_args
.
join
(
' '
)
}
> for
#{
log_username
}
."
exec_cmd
(
*
parsed_args
)
exec_cmd
(
*
parsed_args
)
else
raise
DisallowedCommandError
end
else
else
$logger
.
info
"gitlab-shell: executing git command <
#{
@git_cmd
}
#{
repo_full_path
}
> for
#{
log_username
}
."
$logger
.
info
"gitlab-shell: executing git command <
#{
@git_cmd
}
#{
repo_full_path
}
> for
#{
log_username
}
."
exec_cmd
(
@git_cmd
,
repo_full_path
)
exec_cmd
(
@git_cmd
,
repo_full_path
)
...
...
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