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
Kazuhiko Shiozaki
gitlab-shell
Commits
e8403e8b
Commit
e8403e8b
authored
Apr 06, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move setting/unsetting of GL_ID from lib to executables.
parent
f64e5d4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
20 deletions
+8
-20
hooks/post-receive
hooks/post-receive
+3
-0
lib/gitlab_custom_hook.rb
lib/gitlab_custom_hook.rb
+5
-8
lib/gitlab_post_receive.rb
lib/gitlab_post_receive.rb
+0
-4
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+0
-8
No files found.
hooks/post-receive
View file @
e8403e8b
...
...
@@ -7,6 +7,9 @@ refs = ARGF.read
key_id
=
ENV
[
'GL_ID'
]
repo_path
=
Dir
.
pwd
# reset GL_ID env since we already got its value
ENV
[
'GL_ID'
]
=
nil
require_relative
'../lib/gitlab_custom_hook'
require_relative
'../lib/gitlab_post_receive'
...
...
lib/gitlab_custom_hook.rb
View file @
e8403e8b
...
...
@@ -4,24 +4,21 @@ class GitlabCustomHook
def
pre_receive
(
changes
,
repo_path
)
hook
=
hook_file
(
'pre-receive'
,
repo_path
)
return
true
if
hook
.
nil?
if
call_receive_hook
(
hook
,
changes
)
return
true
else
# reset GL_ID env since we stop git push here
ENV
[
'GL_ID'
]
=
nil
return
false
end
call_receive_hook
(
hook
,
changes
)
end
def
post_receive
(
changes
,
repo_path
)
hook
=
hook_file
(
'post-receive'
,
repo_path
)
return
true
if
hook
.
nil?
call_receive_hook
(
hook
,
changes
)
?
true
:
false
call_receive_hook
(
hook
,
changes
)
end
def
update
(
ref_name
,
old_value
,
new_value
,
repo_path
)
hook
=
hook_file
(
'update'
,
repo_path
)
return
true
if
hook
.
nil?
system
(
hook
,
ref_name
,
old_value
,
new_value
)
end
...
...
lib/gitlab_post_receive.rb
View file @
e8403e8b
...
...
@@ -13,10 +13,6 @@ class GitlabPostReceive
end
def
exec
# reset GL_ID env since we already
# get value from it
ENV
[
'GL_ID'
]
=
nil
result
=
update_redis
begin
...
...
spec/gitlab_post_receive_spec.rb
View file @
e8403e8b
...
...
@@ -24,14 +24,6 @@ describe GitlabPostReceive do
allow
(
gitlab_post_receive
).
to
receive
(
:system
).
and_return
(
true
)
end
it
"resets the GL_ID environment variable"
do
ENV
[
"GL_ID"
]
=
actor
gitlab_post_receive
.
exec
expect
(
ENV
[
"GL_ID"
]).
to
be_nil
end
it
"prints the broadcast message"
do
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
...
...
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