Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
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-ce
Commits
80e984ee
Commit
80e984ee
authored
Dec 08, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project lookup in post receive
parent
db7e0bf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
app/workers/post_receive.rb
app/workers/post_receive.rb
+6
-3
lib/hooks/post-receive
lib/hooks/post-receive
+2
-3
No files found.
app/workers/post_receive.rb
View file @
80e984ee
class
PostReceive
@queue
=
:post_receive
def
self
.
perform
(
reponame
,
oldrev
,
newrev
,
ref
,
identifier
)
project
=
Project
.
find_by_path
(
reponame
)
def
self
.
perform
(
repo_path
,
oldrev
,
newrev
,
ref
,
identifier
)
repo_path
=
repo_path
.
gsub
(
Gitlab
.
config
.
git_base_path
,
""
)
repo_path
=
repo_path
.
gsub
(
/.git$/
,
""
)
project
=
Project
.
find_with_namespace
(
repo_path
)
return
false
if
project
.
nil?
# Ignore push from non-gitlab users
user
=
if
identifier
.
eql?
Gitlab
.
config
.
gitolite_admin_key
user
=
if
identifier
.
eql?
Gitlab
.
config
.
gitolite_admin_key
email
=
project
.
commit
(
newrev
).
author
.
email
rescue
nil
User
.
find_by_email
(
email
)
if
email
elsif
/^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/
.
match
(
identifier
)
...
...
lib/hooks/post-receive
View file @
80e984ee
...
...
@@ -6,7 +6,6 @@
while
read
oldrev newrev ref
do
# For every branch or tag that was pushed, create a Resque job in redis.
pwd
=
`
pwd
`
reponame
=
`
basename
"
$pwd
"
|
sed
s/
\.
git
$/
/
`
env
-i
redis-cli rpush
"resque:gitlab:queue:post_receive"
"{
\"
class
\"
:
\"
PostReceive
\"
,
\"
args
\"
:[
\"
$reponame
\"
,
\"
$oldrev
\"
,
\"
$newrev
\"
,
\"
$ref
\"
,
\"
$GL_USER
\"
]}"
>
/dev/null 2>&1
repo_path
=
`
pwd
`
env
-i
redis-cli rpush
"resque:gitlab:queue:post_receive"
"{
\"
class
\"
:
\"
PostReceive
\"
,
\"
args
\"
:[
\"
$repo_path
\"
,
\"
$oldrev
\"
,
\"
$newrev
\"
,
\"
$ref
\"
,
\"
$GL_USER
\"
]}"
>
/dev/null 2>&1
done
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