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
64296a0d
Commit
64296a0d
authored
Mar 20, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass tag name to update hook too
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
3a960b7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
lib/gitlab_update.rb
lib/gitlab_update.rb
+6
-6
No files found.
lib/gitlab_update.rb
View file @
64296a0d
...
...
@@ -5,7 +5,7 @@ require 'json'
class
GitlabUpdate
attr_reader
:config
def
initialize
(
repo_path
,
actor
,
ref
name
)
def
initialize
(
repo_path
,
actor
,
ref
)
@config
=
GitlabConfig
.
new
@repo_path
=
repo_path
.
strip
...
...
@@ -15,8 +15,8 @@ class GitlabUpdate
@repo_name
.
gsub!
(
/^\//
,
""
)
@actor
=
actor
@ref
name
=
refname
@
branch_name
=
/refs\/heads\/([\/\w\.-]+)/
.
match
(
refname
).
to_a
.
last
@ref
=
ref
@
ref_name
=
ref
.
gsub
(
/\Arefs\/(tags|heads)\//
,
''
)
@oldrev
=
ARGV
[
1
]
@newrev
=
ARGV
[
2
]
...
...
@@ -27,11 +27,11 @@ class GitlabUpdate
# get value from it
ENV
[
'GL_ID'
]
=
nil
if
api
.
allowed?
(
'git-receive-pack'
,
@repo_name
,
@actor
,
@
branch
_name
,
@oldrev
,
@newrev
)
if
api
.
allowed?
(
'git-receive-pack'
,
@repo_name
,
@actor
,
@
ref
_name
,
@oldrev
,
@newrev
)
update_redis
exit
0
else
puts
"GitLab: You are not allowed to access
#{
@
branch
_name
}
!"
puts
"GitLab: You are not allowed to access
#{
@
ref
_name
}
!"
exit
1
end
end
...
...
@@ -44,7 +44,7 @@ class GitlabUpdate
def
update_redis
queue
=
"
#{
config
.
redis_namespace
}
:queue:post_receive"
msg
=
JSON
.
dump
({
'class'
=>
'PostReceive'
,
'args'
=>
[
@repo_path
,
@oldrev
,
@newrev
,
@ref
name
,
@actor
]})
msg
=
JSON
.
dump
({
'class'
=>
'PostReceive'
,
'args'
=>
[
@repo_path
,
@oldrev
,
@newrev
,
@ref
,
@actor
]})
unless
system
(
*
config
.
redis_command
,
'rpush'
,
queue
,
msg
,
err:
'/dev/null'
,
out:
'/dev/null'
)
puts
"GitLab: An unexpected error occurred (redis-cli returned
#{
$?
.
exitstatus
}
)."
exit
1
...
...
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