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
Boxiang Sun
gitlab-ce
Commits
54a24608
Commit
54a24608
authored
Jan 19, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove chdir inside runtime. Improved gitolite shell commands
parent
cfe89832
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
14 deletions
+39
-14
Gemfile
Gemfile
+3
-0
Gemfile.lock
Gemfile.lock
+6
-0
lib/gitlab/backend/gitolite_config.rb
lib/gitlab/backend/gitolite_config.rb
+30
-14
No files found.
Gemfile
View file @
54a24608
...
@@ -127,6 +127,9 @@ group :development do
...
@@ -127,6 +127,9 @@ group :development do
# Docs generator
# Docs generator
gem
"
sdoc
"
gem
"
sdoc
"
# thin instead webrick
gem
'
thin
'
end
end
group
:development
,
:test
do
group
:development
,
:test
do
...
...
Gemfile.lock
View file @
54a24608
...
@@ -144,6 +144,7 @@ GEM
...
@@ -144,6 +144,7 @@ GEM
colorize (0.5.8)
colorize (0.5.8)
connection_pool (1.0.0)
connection_pool (1.0.0)
crack (0.3.1)
crack (0.3.1)
daemons (1.1.9)
devise (2.1.2)
devise (2.1.2)
bcrypt-ruby (~> 3.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
orm_adapter (~> 0.1)
...
@@ -436,6 +437,10 @@ GEM
...
@@ -436,6 +437,10 @@ GEM
test_after_commit (0.0.1)
test_after_commit (0.0.1)
therubyracer (0.10.2)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
libv8 (~> 3.3.10)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.16.0)
thor (0.16.0)
tilt (1.3.3)
tilt (1.3.3)
timers (1.0.2)
timers (1.0.2)
...
@@ -542,6 +547,7 @@ DEPENDENCIES
...
@@ -542,6 +547,7 @@ DEPENDENCIES
stamp
stamp
test_after_commit
test_after_commit
therubyracer
therubyracer
thin
uglifier (~> 1.3.0)
uglifier (~> 1.3.0)
unicorn (~> 4.4.0)
unicorn (~> 4.4.0)
webmock
webmock
lib/gitlab/backend/gitolite_config.rb
View file @
54a24608
...
@@ -77,9 +77,9 @@ module Gitlab
...
@@ -77,9 +77,9 @@ module Gitlab
log
(
"Gitolite error -> "
+
" "
+
ex
.
message
)
log
(
"Gitolite error -> "
+
" "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
,
ex
.
message
raise
Gitolite
::
AccessDenied
,
ex
.
message
rescue
Exception
=>
ex
#
rescue Exception => ex
log
(
ex
.
class
.
name
+
" "
+
ex
.
message
)
#
log(ex.class.name + " " + ex.message)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
#
raise Gitolite::AccessDenied.new("gitolite timeout")
end
end
def
log
message
def
log
message
...
@@ -202,25 +202,41 @@ module Gitlab
...
@@ -202,25 +202,41 @@ module Gitlab
end
end
def
push
tmp_dir
def
push
tmp_dir
Dir
.
chdir
(
File
.
join
(
tmp_dir
,
"gitolite"
))
output
,
status
=
popen
(
'git add -A'
)
raise
"Git add failed."
unless
system
(
'git add -A'
)
raise
"Git add failed."
unless
status
.
zero?
system
(
'git commit -m "GitLab"'
)
# git commit returns 0 on success, and 1 if there is nothing to commit
raise
"Git commit failed."
unless
[
0
,
1
].
include?
$?
.
exitstatus
stdin
,
stdout
,
stderr
=
Open3
.
popen3
(
'git push'
)
# git commit returns 0 on success, and 1 if there is nothing to commit
push_output
=
stderr
.
read
output
,
status
=
popen
(
'git commit -m "GitLab"'
)
push_status
=
$?
.
to_i
raise
"Git add failed."
unless
[
0
,
1
].
include?
(
status
)
if
push_output
=~
/remote\: FATAL/
output
,
status
=
popen
(
'git push'
)
raise
BrokenGitolite
,
push_output
if
output
=~
/remote\: FATAL/
raise
BrokenGitolite
,
output
end
end
if
push_status
.
zero?
if
status
.
zero?
||
output
=~
/Everything up\-to\-date/
Dir
.
chdir
(
Rails
.
root
)
return
true
else
else
raise
PushError
,
"unable to push gitolite-admin repo"
raise
PushError
,
"unable to push gitolite-admin repo"
end
end
end
end
def
popen
(
cmd
)
path
=
File
.
join
(
config_tmp_dir
,
'gitolite'
)
vars
=
{
"PWD"
=>
path
}
options
=
{
:chdir
=>
path
}
@cmd_output
=
""
@cmd_status
=
0
Open3
.
popen3
(
vars
,
cmd
,
options
)
do
|
stdin
,
stdout
,
stderr
,
wait_thr
|
@cmd_status
=
wait_thr
.
value
.
exitstatus
@cmd_output
<<
stdout
.
read
@cmd_output
<<
stderr
.
read
end
return
@cmd_output
,
@cmd_status
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