Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
9b7a6b6f
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b7a6b6f
编写于
10月 04, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #35513
上级
971d7b64
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
10 deletion
+17
-10
extensions/git/src/git.ts
extensions/git/src/git.ts
+17
-10
未找到文件。
extensions/git/src/git.ts
浏览文件 @
9b7a6b6f
...
...
@@ -174,7 +174,13 @@ function cpErrorHandler(cb: (reason?: any) => void): (reason?: any) => void {
};
}
async
function
exec
(
child
:
cp
.
ChildProcess
,
options
:
any
=
{}):
Promise
<
IExecutionResult
>
{
interface
SpawnOptions
extends
cp
.
SpawnOptions
{
input
?:
string
;
encoding
?:
string
;
log
?:
boolean
;
}
async
function
exec
(
child
:
cp
.
ChildProcess
,
options
:
SpawnOptions
=
{}):
Promise
<
IExecutionResult
>
{
if
(
!
child
.
stdout
||
!
child
.
stderr
)
{
throw
new
GitError
({
message
:
'
Failed to get stdout or stderr from git process.
'
...
...
@@ -365,17 +371,17 @@ export class Git {
return
path
.
normalize
(
result
.
stdout
.
trim
());
}
async
exec
(
cwd
:
string
,
args
:
string
[],
options
:
any
=
{}):
Promise
<
IExecutionResult
>
{
async
exec
(
cwd
:
string
,
args
:
string
[],
options
:
SpawnOptions
=
{}):
Promise
<
IExecutionResult
>
{
options
=
assign
({
cwd
},
options
||
{});
return
await
this
.
_exec
(
args
,
options
);
}
stream
(
cwd
:
string
,
args
:
string
[],
options
:
any
=
{}):
cp
.
ChildProcess
{
stream
(
cwd
:
string
,
args
:
string
[],
options
:
SpawnOptions
=
{}):
cp
.
ChildProcess
{
options
=
assign
({
cwd
},
options
||
{});
return
this
.
spawn
(
args
,
options
);
}
private
async
_exec
(
args
:
string
[],
options
:
any
=
{}):
Promise
<
IExecutionResult
>
{
private
async
_exec
(
args
:
string
[],
options
:
SpawnOptions
=
{}):
Promise
<
IExecutionResult
>
{
const
child
=
this
.
spawn
(
args
,
options
);
if
(
options
.
input
)
{
...
...
@@ -402,7 +408,7 @@ export class Git {
return
result
;
}
spawn
(
args
:
string
[],
options
:
any
=
{}):
cp
.
ChildProcess
{
spawn
(
args
:
string
[],
options
:
SpawnOptions
=
{}):
cp
.
ChildProcess
{
if
(
!
this
.
gitPath
)
{
throw
new
Error
(
'
git could not be found in the system.
'
);
}
...
...
@@ -520,19 +526,19 @@ export class Repository {
}
// TODO@Joao: rename to exec
async
run
(
args
:
string
[],
options
:
any
=
{}):
Promise
<
IExecutionResult
>
{
async
run
(
args
:
string
[],
options
:
SpawnOptions
=
{}):
Promise
<
IExecutionResult
>
{
return
await
this
.
git
.
exec
(
this
.
repositoryRoot
,
args
,
options
);
}
stream
(
args
:
string
[],
options
:
any
=
{}):
cp
.
ChildProcess
{
stream
(
args
:
string
[],
options
:
SpawnOptions
=
{}):
cp
.
ChildProcess
{
return
this
.
git
.
stream
(
this
.
repositoryRoot
,
args
,
options
);
}
spawn
(
args
:
string
[],
options
:
any
=
{}):
cp
.
ChildProcess
{
spawn
(
args
:
string
[],
options
:
SpawnOptions
=
{}):
cp
.
ChildProcess
{
return
this
.
git
.
spawn
(
args
,
options
);
}
async
config
(
scope
:
string
,
key
:
string
,
value
:
any
,
options
:
any
):
Promise
<
string
>
{
async
config
(
scope
:
string
,
key
:
string
,
value
:
any
,
options
:
SpawnOptions
):
Promise
<
string
>
{
const
args
=
[
'
config
'
];
if
(
scope
)
{
...
...
@@ -898,7 +904,8 @@ export class Repository {
getStatus
(
limit
=
5000
):
Promise
<
{
status
:
IFileStatus
[];
didHitLimit
:
boolean
;
}
>
{
return
new
Promise
<
{
status
:
IFileStatus
[];
didHitLimit
:
boolean
;
}
>
((
c
,
e
)
=>
{
const
parser
=
new
GitStatusParser
();
const
child
=
this
.
stream
([
'
status
'
,
'
-z
'
,
'
-u
'
]);
const
env
=
{
GIT_OPTIONAL_LOCKS
:
'
0
'
};
const
child
=
this
.
stream
([
'
status
'
,
'
-z
'
,
'
-u
'
],
{
env
});
const
onExit
=
exitCode
=>
{
if
(
exitCode
!==
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录