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
33c8d487
Commit
33c8d487
authored
Oct 01, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-shell into no-init-on-gcryptsetup
parents
979a6df4
57bc5729
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
5 deletions
+68
-5
CHANGELOG
CHANGELOG
+7
-0
VERSION
VERSION
+1
-1
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+12
-4
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+3
-0
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+45
-0
No files found.
CHANGELOG
View file @
33c8d487
v2.6.6 (unreleased)
- Do not clean LANG environment variable for the git hooks when working through the SSH-protocol
- Add git-lfs-authenticate command to white list (this command is used by git-lfs for SSO authentication through SSH-protocol)
v2.6.5
- Handle broken symlinks in create-hooks
v2.6.4
- Remove keys from authorized_keys in-place
- Increase batch_add_keys lock timeout to 300 seconds
...
...
VERSION
View file @
33c8d487
2.6.
4
2.6.
5
lib/gitlab_projects.rb
View file @
33c8d487
...
...
@@ -21,11 +21,19 @@ class GitlabProjects
def
self
.
create_hooks
(
path
)
local_hooks_directory
=
File
.
join
(
path
,
'hooks'
)
real_local_hooks_directory
=
:not_found
begin
real_local_hooks_directory
=
File
.
realpath
(
local_hooks_directory
)
rescue
Errno
::
ENOENT
# real_local_hooks_directory == :not_found
end
if
File
.
realpath
(
local_hooks_directory
)
!=
File
.
realpath
(
GLOBAL_HOOKS_DIRECTORY
)
$logger
.
info
"Moving existing hooks directory and symlinking global hooks directory for
#{
path
}
."
FileUtils
.
mv
(
local_hooks_directory
,
"
#{
local_hooks_directory
}
.old.
#{
Time
.
now
.
to_i
}
"
)
FileUtils
.
ln_s
(
GLOBAL_HOOKS_DIRECTORY
,
local_hooks_directory
)
if
real_local_hooks_directory
!=
File
.
realpath
(
GLOBAL_HOOKS_DIRECTORY
)
if
File
.
exist?
(
local_hooks_directory
)
$logger
.
info
"Moving existing hooks directory and symlinking global hooks directory for
#{
path
}
."
FileUtils
.
mv
(
local_hooks_directory
,
"
#{
local_hooks_directory
}
.old.
#{
Time
.
now
.
to_i
}
"
)
end
FileUtils
.
ln_sf
(
GLOBAL_HOOKS_DIRECTORY
,
local_hooks_directory
)
else
$logger
.
info
"Hooks already exist for
#{
path
}
."
true
...
...
lib/gitlab_shell.rb
View file @
33c8d487
...
...
@@ -111,6 +111,8 @@ class GitlabShell
$logger
.
info
"gitlab-shell: executing git-annex command <
#{
parsed_args
.
join
(
' '
)
}
> for
#{
log_username
}
."
exec_cmd
(
*
parsed_args
)
elsif
@git_cmd
==
'git-lfs-authenticate'
exec_cmd
(
@origin_cmd
)
else
$logger
.
info
"gitlab-shell: executing git command <
#{
@git_cmd
}
#{
repo_full_path
}
> for
#{
log_username
}
."
exec_cmd
(
@git_cmd
,
repo_full_path
)
...
...
@@ -122,6 +124,7 @@ class GitlabShell
env
=
{
'PATH'
=>
ENV
[
'PATH'
],
'LD_LIBRARY_PATH'
=>
ENV
[
'LD_LIBRARY_PATH'
],
'LANG'
=>
ENV
[
'LANG'
],
'GL_ID'
=>
@key_id
}
...
...
spec/gitlab_projects_spec.rb
View file @
33c8d487
...
...
@@ -12,6 +12,51 @@ describe GitlabProjects do
FileUtils
.
rm_rf
(
tmp_repos_path
)
end
describe
:create_hooks
do
let
(
:repo_path
)
{
File
.
join
(
tmp_repos_path
,
'hook-test.git'
)
}
let
(
:hooks_dir
)
{
File
.
join
(
repo_path
,
'hooks'
)
}
let
(
:target_hooks_dir
)
{
File
.
join
(
ROOT_PATH
,
'hooks'
)
}
let
(
:existing_target
)
{
File
.
join
(
repo_path
,
'foobar'
)
}
before
do
FileUtils
.
rm_rf
(
repo_path
)
FileUtils
.
mkdir_p
(
repo_path
)
end
context
'hooks is a directory'
do
let
(
:existing_file
)
{
File
.
join
(
hooks_dir
,
'my-file'
)
}
before
do
FileUtils
.
mkdir_p
(
hooks_dir
)
FileUtils
.
touch
(
existing_file
)
GitlabProjects
.
create_hooks
(
repo_path
)
end
it
{
File
.
readlink
(
hooks_dir
).
should
==
target_hooks_dir
}
it
{
Dir
[
File
.
join
(
repo_path
,
"hooks.old.*/my-file"
)].
count
.
should
==
1
}
end
context
'hooks is a valid symlink'
do
before
do
FileUtils
.
mkdir_p
existing_target
File
.
symlink
(
existing_target
,
hooks_dir
)
GitlabProjects
.
create_hooks
(
repo_path
)
end
it
{
File
.
readlink
(
hooks_dir
).
should
==
target_hooks_dir
}
end
context
'hooks is a broken symlink'
do
before
do
FileUtils
.
rm_f
(
existing_target
)
File
.
symlink
(
existing_target
,
hooks_dir
)
GitlabProjects
.
create_hooks
(
repo_path
)
end
it
{
File
.
readlink
(
hooks_dir
).
should
==
target_hooks_dir
}
end
end
describe
:initialize
do
before
do
argv
(
'add-project'
,
repo_name
)
...
...
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