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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
db81327b
Commit
db81327b
authored
Sep 16, 2014
by
Jacob Vosmaer
4
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Symlink the whole hooks directory
parent
27fe2ea5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+6
-4
No files found.
CHANGELOG
View file @
db81327b
...
@@ -3,6 +3,7 @@ v2.0.0
...
@@ -3,6 +3,7 @@ v2.0.0
- Replace raise with abort when checking path to prevent path exposure
- Replace raise with abort when checking path to prevent path exposure
- Handle invalid number of arguments on remote commands
- Handle invalid number of arguments on remote commands
- Replace update hook with pre-receive and post-receive hooks.
- Replace update hook with pre-receive and post-receive hooks.
- Symlink the whole hooks directory
- Ignore missing repositories in create-hooks
- Ignore missing repositories in create-hooks
- Connect to Redis via sockets by default
- Connect to Redis via sockets by default
...
...
lib/gitlab_projects.rb
View file @
db81327b
...
@@ -5,6 +5,8 @@ require_relative 'gitlab_config'
...
@@ -5,6 +5,8 @@ require_relative 'gitlab_config'
require_relative
'gitlab_logger'
require_relative
'gitlab_logger'
class
GitlabProjects
class
GitlabProjects
GLOBAL_HOOKS_DIRECTORY
=
File
.
join
(
ROOT_PATH
,
'hooks'
)
# Project name is a directory name for repository with .git at the end
# Project name is a directory name for repository with .git at the end
# It may be namespaced or not. Like repo.git or gitlab/repo.git
# It may be namespaced or not. Like repo.git or gitlab/repo.git
attr_reader
:project_name
attr_reader
:project_name
...
@@ -18,10 +20,10 @@ class GitlabProjects
...
@@ -18,10 +20,10 @@ class GitlabProjects
attr_reader
:full_path
attr_reader
:full_path
def
self
.
create_hooks
(
path
)
def
self
.
create_hooks
(
path
)
%w(pre-receive post-receive)
.
each
do
|
hook_name
|
local_hooks_directory
=
File
.
join
(
path
,
'hooks'
)
hook
=
File
.
join
(
path
,
'hooks'
,
hook_name
)
unless
File
.
realpath
(
local_hooks_directory
)
==
File
.
realpath
(
GLOBAL_HOOKS_DIRECTORY
)
File
.
delete
(
hook
)
if
File
.
exists?
(
hook
)
File
Utils
.
mv
(
local_hooks_directory
,
"
#{
local_hooks_directory
}
.
#{
Time
.
now
.
to_i
}
"
)
File
.
symlink
(
File
.
join
(
ROOT_PATH
,
'hooks'
,
hook_name
),
hook
)
File
Utils
.
ln_s
(
GLOBAL_HOOKS_DIRECTORY
,
local_hooks_directory
)
end
end
end
end
...
...
Kirill Smelkov
@kirr
mentioned in commit
cb8f331c
·
Feb 25, 2016
mentioned in commit
cb8f331c
mentioned in commit cb8f331c955aa780efe10263d0d45b332f030f42
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
03df9d7f
·
Apr 08, 2016
mentioned in commit
03df9d7f
mentioned in commit 03df9d7f9cfaa9e058f4c7053a497069b9b52657
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
fbca95be
·
Aug 03, 2016
mentioned in commit
fbca95be
mentioned in commit fbca95be784816349abc5930324659151eca50d1
Toggle commit list
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