Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
91ff0eaa
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,发现更多精彩内容 >>
未验证
提交
91ff0eaa
编写于
3月 12, 2018
作者:
N
Nick Thomas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Respect the configured git path for imported gitlab-shell operations
上级
cc72e1bc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
lib/gitlab/git/gitlab_projects.rb
lib/gitlab/git/gitlab_projects.rb
+6
-6
spec/lib/gitlab/git/gitlab_projects_spec.rb
spec/lib/gitlab/git/gitlab_projects_spec.rb
+7
-7
未找到文件。
lib/gitlab/git/gitlab_projects.rb
浏览文件 @
91ff0eaa
...
...
@@ -67,7 +67,7 @@ module Gitlab
tags_option
=
tags
?
'--tags'
:
'--no-tags'
logger
.
info
"Fetching remote
#{
name
}
for repository
#{
repository_absolute_path
}
."
cmd
=
%W(
git
fetch
#{
name
}
--quiet)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
name
}
--quiet)
cmd
<<
'--prune'
if
prune
cmd
<<
'--force'
if
force
cmd
<<
tags_option
...
...
@@ -85,7 +85,7 @@ module Gitlab
def
push_branches
(
remote_name
,
timeout
,
force
,
branch_names
)
logger
.
info
"Pushing branches from
#{
repository_absolute_path
}
to remote
#{
remote_name
}
:
#{
branch_names
}
"
cmd
=
%
w(git
push)
cmd
=
%
W(
#{
Gitlab
.
config
.
git
.
bin_path
}
push)
cmd
<<
'--force'
if
force
cmd
+=
%W(--
#{
remote_name
}
)
.
concat
(
branch_names
)
...
...
@@ -102,7 +102,7 @@ module Gitlab
branches
=
branch_names
.
map
{
|
branch_name
|
":
#{
branch_name
}
"
}
logger
.
info
"Pushing deleted branches from
#{
repository_absolute_path
}
to remote
#{
remote_name
}
:
#{
branch_names
}
"
cmd
=
%W(
git
push --
#{
remote_name
}
)
.
concat
(
branches
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
push --
#{
remote_name
}
)
.
concat
(
branches
)
success
=
run
(
cmd
,
repository_absolute_path
)
...
...
@@ -143,7 +143,7 @@ module Gitlab
end
def
remove_origin_in_repo
cmd
=
%
w(git
remote rm origin)
cmd
=
%
W(
#{
Gitlab
.
config
.
git
.
bin_path
}
remote rm origin)
run
(
cmd
,
repository_absolute_path
)
end
...
...
@@ -223,7 +223,7 @@ module Gitlab
masked_source
=
mask_password_in_url
(
source
)
logger
.
info
"Importing project from <
#{
masked_source
}
> to <
#{
repository_absolute_path
}
>."
cmd
=
%W(
git
clone --bare --
#{
source
}
#{
repository_absolute_path
}
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
clone --bare --
#{
source
}
#{
repository_absolute_path
}
)
success
=
run_with_timeout
(
cmd
,
timeout
,
nil
)
...
...
@@ -266,7 +266,7 @@ module Gitlab
FileUtils
.
mkdir_p
(
File
.
dirname
(
to_path
),
mode:
0770
)
logger
.
info
"Forking repository from <
#{
from_path
}
> to <
#{
to_path
}
>."
cmd
=
%W(
git
clone --bare --no-local --
#{
from_path
}
#{
to_path
}
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
clone --bare --no-local --
#{
from_path
}
#{
to_path
}
)
run
(
cmd
,
nil
)
&&
Gitlab
::
Git
::
Repository
.
create_hooks
(
to_path
,
global_hooks_path
)
end
...
...
spec/lib/gitlab/git/gitlab_projects_spec.rb
浏览文件 @
91ff0eaa
...
...
@@ -28,7 +28,7 @@ describe Gitlab::Git::GitlabProjects do
describe
'#push_branches'
do
let
(
:remote_name
)
{
'remote-name'
}
let
(
:branch_name
)
{
'master'
}
let
(
:cmd
)
{
%W(
git
push --
#{
remote_name
}
#{
branch_name
}
)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
push --
#{
remote_name
}
#{
branch_name
}
)
}
let
(
:force
)
{
false
}
subject
{
gl_projects
.
push_branches
(
remote_name
,
600
,
force
,
[
branch_name
])
}
...
...
@@ -46,7 +46,7 @@ describe Gitlab::Git::GitlabProjects do
end
context
'with --force'
do
let
(
:cmd
)
{
%W(
git
push --force --
#{
remote_name
}
#{
branch_name
}
)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
push --force --
#{
remote_name
}
#{
branch_name
}
)
}
let
(
:force
)
{
true
}
it
'executes the command'
do
...
...
@@ -65,7 +65,7 @@ describe Gitlab::Git::GitlabProjects do
let
(
:tags
)
{
true
}
let
(
:args
)
{
{
force:
force
,
tags:
tags
,
prune:
prune
}.
merge
(
extra_args
)
}
let
(
:extra_args
)
{
{}
}
let
(
:cmd
)
{
%W(
git
fetch
#{
remote_name
}
--quiet --prune --tags)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
remote_name
}
--quiet --prune --tags)
}
subject
{
gl_projects
.
fetch_remote
(
remote_name
,
600
,
args
)
}
...
...
@@ -98,7 +98,7 @@ describe Gitlab::Git::GitlabProjects do
context
'with --force'
do
let
(
:force
)
{
true
}
let
(
:cmd
)
{
%W(
git
fetch
#{
remote_name
}
--quiet --prune --force --tags)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
remote_name
}
--quiet --prune --force --tags)
}
it
'executes the command with forced option'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
...
...
@@ -109,7 +109,7 @@ describe Gitlab::Git::GitlabProjects do
context
'with --no-tags'
do
let
(
:tags
)
{
false
}
let
(
:cmd
)
{
%W(
git
fetch
#{
remote_name
}
--quiet --prune --no-tags)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
remote_name
}
--quiet --prune --no-tags)
}
it
'executes the command'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
...
...
@@ -120,7 +120,7 @@ describe Gitlab::Git::GitlabProjects do
context
'with no prune'
do
let
(
:prune
)
{
false
}
let
(
:cmd
)
{
%W(
git
fetch
#{
remote_name
}
--quiet --tags)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
remote_name
}
--quiet --tags)
}
it
'executes the command'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
...
...
@@ -165,7 +165,7 @@ describe Gitlab::Git::GitlabProjects do
describe
'#import_project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:import_url
)
{
TestEnv
.
factory_repo_path_bare
}
let
(
:cmd
)
{
%W(
git
clone --bare --
#{
import_url
}
#{
tmp_repo_path
}
)
}
let
(
:cmd
)
{
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
clone --bare --
#{
import_url
}
#{
tmp_repo_path
}
)
}
let
(
:timeout
)
{
600
}
subject
{
gl_projects
.
import_project
(
import_url
,
timeout
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录