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
Kazuhiko Shiozaki
gitlab-ce
Commits
c48c0f95
Commit
c48c0f95
authored
Aug 29, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitlab::Gitolite final fixes. Seems like all functionality is working correctly now
parent
e8e8ca94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
39 deletions
+41
-39
lib/gitlab/backend/gitolite.rb
lib/gitlab/backend/gitolite.rb
+41
-39
No files found.
lib/gitlab/backend/gitolite.rb
View file @
c48c0f95
...
@@ -10,14 +10,14 @@ module Gitlab
...
@@ -10,14 +10,14 @@ module Gitlab
def
set_key
key_id
,
key_content
,
projects
def
set_key
key_id
,
key_content
,
projects
configure
do
|
c
|
configure
do
|
c
|
c
.
update_keys
(
key_id
,
key_content
)
c
.
update_keys
(
key_id
,
key_content
)
c
.
update_project
(
project
.
path
,
projects
)
c
.
update_project
s
(
projects
)
end
end
end
end
def
remove_key
key_id
,
projects
def
remove_key
key_id
,
projects
configure
do
|
c
|
configure
do
|
c
|
c
.
delete_key
(
key_id
)
c
.
delete_key
(
key_id
)
c
.
update_project
(
project
.
path
,
projects
)
c
.
update_project
s
(
projects
)
end
end
end
end
...
@@ -50,43 +50,7 @@ module Gitlab
...
@@ -50,43 +50,7 @@ module Gitlab
end
end
end
end
private
protected
def
pull
# create tmp dir
@local_dir
=
File
.
join
(
Rails
.
root
,
'tmp'
,
"gitlabhq-gitolite-
#{
Time
.
now
.
to_i
}
"
)
Dir
.
mkdir
@local_dir
`git clone
#{
Gitlab
.
config
.
gitolite_admin_uri
}
#{
@local_dir
}
/gitolite`
end
def
push
Dir
.
chdir
(
File
.
join
(
@local_dir
,
"gitolite"
))
`git add -A`
`git commit -am "Gitlab"`
`git push`
Dir
.
chdir
(
Rails
.
root
)
FileUtils
.
rm_rf
(
@local_dir
)
end
def
configure
Timeout
::
timeout
(
30
)
do
File
.
open
(
File
.
join
(
Rails
.
root
,
'tmp'
,
"gitlabhq-gitolite.lock"
),
"w+"
)
do
|
f
|
begin
f
.
flock
(
File
::
LOCK_EX
)
pull
yield
(
self
)
push
ensure
f
.
flock
(
File
::
LOCK_UN
)
end
end
end
rescue
Exception
=>
ex
Gitlab
::
Logger
.
error
(
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
end
def
destroy_project
(
project
)
def
destroy_project
(
project
)
FileUtils
.
rm_rf
(
project
.
path_to_repo
)
FileUtils
.
rm_rf
(
project
.
path_to_repo
)
...
@@ -191,5 +155,43 @@ module Gitlab
...
@@ -191,5 +155,43 @@ module Gitlab
conf
.
add_repo
(
repo
,
true
)
conf
.
add_repo
(
repo
,
true
)
ga_repo
.
save
ga_repo
.
save
end
end
private
def
pull
# create tmp dir
@local_dir
=
File
.
join
(
Rails
.
root
,
'tmp'
,
"gitlabhq-gitolite-
#{
Time
.
now
.
to_i
}
"
)
Dir
.
mkdir
@local_dir
`git clone
#{
Gitlab
.
config
.
gitolite_admin_uri
}
#{
@local_dir
}
/gitolite`
end
def
push
Dir
.
chdir
(
File
.
join
(
@local_dir
,
"gitolite"
))
`git add -A`
`git commit -am "Gitlab"`
`git push`
Dir
.
chdir
(
Rails
.
root
)
FileUtils
.
rm_rf
(
@local_dir
)
end
def
configure
Timeout
::
timeout
(
30
)
do
File
.
open
(
File
.
join
(
Rails
.
root
,
'tmp'
,
"gitlabhq-gitolite.lock"
),
"w+"
)
do
|
f
|
begin
f
.
flock
(
File
::
LOCK_EX
)
pull
yield
(
self
)
push
ensure
f
.
flock
(
File
::
LOCK_UN
)
end
end
end
rescue
Exception
=>
ex
Gitlab
::
Logger
.
error
(
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
end
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