Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
54a24608
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
54a24608
编写于
1月 19, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove chdir inside runtime. Improved gitolite shell commands
上级
cfe89832
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
14 deletion
+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
未找到文件。
Gemfile
浏览文件 @
54a24608
...
...
@@ -127,6 +127,9 @@ group :development do
# Docs generator
gem
"
sdoc
"
# thin instead webrick
gem
'
thin
'
end
group
:development
,
:test
do
...
...
Gemfile.lock
浏览文件 @
54a24608
...
...
@@ -144,6 +144,7 @@ GEM
colorize (0.5.8)
connection_pool (1.0.0)
crack (0.3.1)
daemons (1.1.9)
devise (2.1.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
...
...
@@ -436,6 +437,10 @@ GEM
test_after_commit (0.0.1)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.16.0)
tilt (1.3.3)
timers (1.0.2)
...
...
@@ -542,6 +547,7 @@ DEPENDENCIES
stamp
test_after_commit
therubyracer
thin
uglifier (~> 1.3.0)
unicorn (~> 4.4.0)
webmock
lib/gitlab/backend/gitolite_config.rb
浏览文件 @
54a24608
...
...
@@ -77,9 +77,9 @@ module Gitlab
log
(
"Gitolite error -> "
+
" "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
,
ex
.
message
rescue
Exception
=>
ex
log
(
ex
.
class
.
name
+
" "
+
ex
.
message
)
raise
Gitolite
::
AccessDenied
.
new
(
"gitolite timeout"
)
#
rescue Exception => ex
#
log(ex.class.name + " " + ex.message)
#
raise Gitolite::AccessDenied.new("gitolite timeout")
end
def
log
message
...
...
@@ -202,25 +202,41 @@ module Gitlab
end
def
push
tmp_dir
Dir
.
chdir
(
File
.
join
(
tmp_dir
,
"gitolite"
))
raise
"Git add failed."
unless
system
(
'git add -A'
)
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
output
,
status
=
popen
(
'git add -A'
)
raise
"Git add failed."
unless
status
.
zero?
stdin
,
stdout
,
stderr
=
Open3
.
popen3
(
'git push'
)
push_output
=
stderr
.
read
push_status
=
$?
.
to_i
# git commit returns 0 on success, and 1 if there is nothing to commit
output
,
status
=
popen
(
'git commit -m "GitLab"'
)
raise
"Git add failed."
unless
[
0
,
1
].
include?
(
status
)
if
push_output
=~
/remote\: FATAL/
raise
BrokenGitolite
,
push_output
output
,
status
=
popen
(
'git push'
)
if
output
=~
/remote\: FATAL/
raise
BrokenGitolite
,
output
end
if
push_status
.
zero?
Dir
.
chdir
(
Rails
.
root
)
if
status
.
zero?
||
output
=~
/Everything up\-to\-date/
return
true
else
raise
PushError
,
"unable to push gitolite-admin repo"
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录