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
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
iv
gitlab-ce
Commits
c625293b
Commit
c625293b
authored
Aug 21, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle post-receive files via gitolite, not gitlab
parent
2e7ca8c8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
46 deletions
+29
-46
app/roles/repository.rb
app/roles/repository.rb
+0
-18
app/views/errors/gitolite.html.haml
app/views/errors/gitolite.html.haml
+0
-2
lib/hooks/post-receive
lib/hooks/post-receive
+0
-0
lib/tasks/gitlab/setup.rake
lib/tasks/gitlab/setup.rake
+6
-1
lib/tasks/gitlab/status.rake
lib/tasks/gitlab/status.rake
+0
-6
lib/tasks/gitlab/update_hooks.rake
lib/tasks/gitlab/update_hooks.rake
+0
-19
lib/tasks/gitlab/write_hook.rake
lib/tasks/gitlab/write_hook.rake
+23
-0
No files found.
app/roles/repository.rb
View file @
c625293b
...
...
@@ -30,26 +30,10 @@ module Repository
Commit
.
commits_between
(
repo
,
from
,
to
)
end
def
write_hooks
%w(post-receive)
.
each
do
|
hook
|
write_hook
(
hook
,
File
.
read
(
File
.
join
(
Rails
.
root
,
'lib'
,
"
#{
hook
}
-hook"
)))
end
end
def
satellite
@satellite
||=
Gitlab
::
Satellite
.
new
(
self
)
end
def
write_hook
(
name
,
content
)
hook_file
=
File
.
join
(
path_to_repo
,
'hooks'
,
name
)
File
.
open
(
hook_file
,
'w'
)
do
|
f
|
f
.
write
(
content
)
end
File
.
chmod
(
0775
,
hook_file
)
end
def
has_post_receive_file?
hook_file
=
File
.
join
(
path_to_repo
,
'hooks'
,
'post-receive'
)
File
.
exists?
(
hook_file
)
...
...
@@ -73,8 +57,6 @@ module Repository
def
update_repository
Gitlab
::
GitHost
.
system
.
update_project
(
path
,
self
)
write_hooks
if
File
.
exists?
(
path_to_repo
)
end
def
destroy_repository
...
...
app/views/errors/gitolite.html.haml
View file @
c625293b
...
...
@@ -23,5 +23,3 @@
=
preserve
do
sudo chmod -R 770 /home/git/repositories/
sudo chown -R git:git /home/git/repositories/
sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive
lib/
post-receive-hook
→
lib/
hooks/post-receive
View file @
c625293b
File moved
lib/tasks/gitlab/setup.rake
View file @
c625293b
namespace
:gitlab
do
namespace
:app
do
desc
"GITLAB | Setup production application"
task
:setup
=>
[
'db:setup'
,
'db:seed_fu'
,
'gitlab:app:enable_automerge'
]
task
:setup
=>
[
'db:setup'
,
'db:seed_fu'
,
'gitlab:gitolite:write_hooks'
,
'gitlab:app:enable_automerge'
]
end
end
lib/tasks/gitlab/status.rake
View file @
c625293b
...
...
@@ -67,12 +67,6 @@ namespace :gitlab do
next
end
unless
File
.
owned?
(
hook_file
)
puts
"post-receive file is not owner by gitlab"
.
red
next
end
puts
"post-reveice file ok"
.
green
end
end
...
...
lib/tasks/gitlab/update_hooks.rake
deleted
100644 → 0
View file @
2e7ca8c8
namespace
:gitlab
do
namespace
:gitolite
do
desc
"GITLAB | Rewrite hooks for repos"
task
:update_hooks
=>
:environment
do
puts
"Starting Projects"
Project
.
find_each
(
:batch_size
=>
100
)
do
|
project
|
begin
if
project
.
commit
project
.
write_hooks
print
"."
.
green
end
rescue
Exception
=>
e
print
e
.
message
.
red
end
end
puts
"
\n
Done with projects"
end
end
end
lib/tasks/gitlab/write_hook.rake
0 → 100644
View file @
c625293b
namespace
:gitlab
do
namespace
:gitolite
do
desc
"GITLAB | Write GITLAB hook for gitolite"
task
:write_hooks
=>
:environment
do
gitolite_hooks_path
=
File
.
join
(
"/home"
,
Gitlab
.
config
.
ssh_user
,
"share"
,
"gitolite"
,
"hooks"
,
"common"
)
gitlab_hooks_path
=
Rails
.
root
.
join
(
"lib"
,
"hooks"
)
gitlab_hook_files
=
[
'post-receive'
]
gitlab_hook_files
.
each
do
|
file_name
|
source
=
File
.
join
(
gitlab_hooks_path
,
file_name
)
dest
=
File
.
join
(
gitolite_hooks_path
,
file_name
)
puts
"sudo -u root cp
#{
source
}
#{
dest
}
"
.
yellow
`sudo -u root cp
#{
source
}
#{
dest
}
`
puts
"sudo -u root chown git:git
#{
dest
}
"
.
yellow
`sudo -u root chown git:git
#{
dest
}
`
end
end
end
end
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