Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
afdaf562
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
afdaf562
编写于
3月 20, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🐛
fix git clone command
fixes #22620
上级
3930741b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
126 addition
and
103 deletion
+126
-103
extensions/git/package.json
extensions/git/package.json
+89
-64
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+28
-23
extensions/git/src/main.ts
extensions/git/src/main.ts
+6
-9
extensions/git/src/model.ts
extensions/git/src/model.ts
+3
-7
未找到文件。
extensions/git/package.json
浏览文件 @
afdaf562
...
...
@@ -27,6 +27,11 @@
"title"
:
"%command.clone%"
,
"category"
:
"Git"
},
{
"command"
:
"git.cloneSilent"
,
"title"
:
"%command.clone%"
,
"category"
:
"Git"
},
{
"command"
:
"git.init"
,
"title"
:
"%command.init%"
,
...
...
@@ -214,295 +219,315 @@
],
"menus"
:
{
"commandPalette"
:
[
{
"command"
:
"git.clone"
,
"when"
:
"false"
},
{
"command"
:
"git.cloneSilent"
,
"when"
:
"config.git.enabled"
},
{
"command"
:
"git.init"
,
"when"
:
"scmProvider == git && scmProviderState == norepo"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == norepo"
},
{
"command"
:
"git.refresh"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.openChange"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.openFile"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.stageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"config.git.enabled && scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.stageSelectedRanges"
,
"when"
:
"config.git.enabled && scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.revertSelectedRanges"
,
"when"
:
"config.git.enabled && scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.unstage"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.unstageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"config.git.enabled && scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.unstageSelectedRanges"
,
"when"
:
"config.git.enabled && scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.clean"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.cleanAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitStaged"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitStagedSigned"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitAllSigned"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.undoCommit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.checkout"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.branch"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pull"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pullRebase"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.push"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pushTo"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.publish"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.showOutput"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
}
],
"scm/title"
:
[
{
"command"
:
"git.init"
,
"group"
:
"navigation"
,
"when"
:
"scmProvider == git && scmProviderState == norepo"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == norepo"
},
{
"command"
:
"git.commit"
,
"group"
:
"navigation"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.refresh"
,
"group"
:
"navigation"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.sync"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pull"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pullRebase"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.push"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.pushTo"
,
"group"
:
"1_sync"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.publish"
,
"group"
:
"2_publish"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitStaged"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitStagedSigned"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitAll"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.commitAllSigned"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.undoCommit"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.unstageAll"
,
"group"
:
"4_stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.cleanAll"
,
"group"
:
"4_stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
},
{
"command"
:
"git.showOutput"
,
"group"
:
"5_output"
,
"when"
:
"scmProvider == git && scmProviderState == idle"
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle"
}
],
"scm/resourceGroup/context"
:
[
{
"command"
:
"git.stageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.stageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"group"
:
"inline"
},
{
"command"
:
"git.unstageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.unstageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"inline"
},
{
"command"
:
"git.cleanAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.stageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.cleanAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"inline"
},
{
"command"
:
"git.stageAll"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"inline"
}
],
"scm/resource/context"
:
[
{
"command"
:
"git.stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == merge"
,
"group"
:
"inline"
},
{
"command"
:
"git.openChange"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"navigation"
},
{
"command"
:
"git.openFile"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"navigation"
},
{
"command"
:
"git.unstage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.unstage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == index"
,
"group"
:
"inline"
},
{
"command"
:
"git.openChange"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"navigation"
},
{
"command"
:
"git.openFile"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"navigation"
},
{
"command"
:
"git.stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.clean"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"1_modification"
},
{
"command"
:
"git.clean"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"inline"
},
{
"command"
:
"git.stage"
,
"when"
:
"scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"when"
:
"
config.git.enabled &&
scmProvider == git && scmProviderState == idle && scmResourceGroup == workingTree"
,
"group"
:
"inline"
}
],
...
...
@@ -510,12 +535,12 @@
{
"command"
:
"git.openFile"
,
"group"
:
"navigation"
,
"when"
:
"isInDiffEditor && resourceScheme != extension"
"when"
:
"
config.git.enabled && scmProvider == git &&
isInDiffEditor && resourceScheme != extension"
},
{
"command"
:
"git.openChange"
,
"group"
:
"navigation"
,
"when"
:
"!isInDiffEditor && resourceScheme != extension"
"when"
:
"
config.git.enabled && scmProvider == git &&
!isInDiffEditor && resourceScheme != extension"
}
]
},
...
...
extensions/git/src/commands.ts
浏览文件 @
afdaf562
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
Uri
,
commands
,
scm
,
Disposable
,
window
,
workspace
,
QuickPickItem
,
OutputChannel
,
computeDiff
,
Range
,
WorkspaceEdit
,
Position
}
from
'
vscode
'
;
import
{
Ref
,
RefType
}
from
'
./git
'
;
import
{
Ref
,
RefType
,
Git
}
from
'
./git
'
;
import
{
Model
,
Resource
,
Status
,
CommitOptions
}
from
'
./model
'
;
import
*
as
staging
from
'
./staging
'
;
import
*
as
path
from
'
path
'
;
...
...
@@ -59,15 +59,15 @@ class CheckoutRemoteHeadItem extends CheckoutItem {
}
}
const
Commands
:
{
commandId
:
string
;
key
:
string
;
method
:
Function
;
}[]
=
[];
const
Commands
:
{
commandId
:
string
;
key
:
string
;
method
:
Function
;
skipModelCheck
:
boolean
;
}[]
=
[];
function
command
(
commandId
:
string
):
Function
{
function
command
(
commandId
:
string
,
skipModelCheck
=
false
):
Function
{
return
(
target
:
any
,
key
:
string
,
descriptor
:
any
)
=>
{
if
(
!
(
typeof
descriptor
.
value
===
'
function
'
))
{
throw
new
Error
(
'
not supported
'
);
}
Commands
.
push
({
commandId
,
key
,
method
:
descriptor
.
value
});
Commands
.
push
({
commandId
,
key
,
method
:
descriptor
.
value
,
skipModelCheck
});
};
}
...
...
@@ -77,6 +77,7 @@ export class CommandCenter {
private
disposables
:
Disposable
[];
constructor
(
private
git
:
Git
,
model
:
Model
|
undefined
,
private
outputChannel
:
OutputChannel
,
private
telemetryReporter
:
TelemetryReporter
...
...
@@ -86,7 +87,7 @@ export class CommandCenter {
}
this
.
disposables
=
Commands
.
map
(({
commandId
,
key
,
method
})
=>
commands
.
registerCommand
(
commandId
,
this
.
createCommand
(
commandId
,
key
,
method
)));
.
map
(({
commandId
,
key
,
method
,
skipModelCheck
})
=>
commands
.
registerCommand
(
commandId
,
this
.
createCommand
(
commandId
,
key
,
method
,
skipModelCheck
)));
}
@
command
(
'
git.refresh
'
)
...
...
@@ -169,19 +170,7 @@ export class CommandCenter {
return
''
;
}
/**
* Attempts to clone a git repository. Throws descriptive errors
* for usual error cases. Returns whether the user chose to open
* the resulting folder or otherwise.
*
* This only exists for the walkthrough contribution to have good
* telemetry.
*
* TODO@Christof: when all the telemetry questions are answered,
* please clean this up into a single clone method.
*/
@
command
(
'
_git.clone
'
)
async
_clone
():
Promise
<
boolean
>
{
private
async
_clone
():
Promise
<
boolean
>
{
const
url
=
await
window
.
showInputBox
({
prompt
:
localize
(
'
repourl
'
,
"
Repository URL
"
),
ignoreFocusOut
:
true
...
...
@@ -201,7 +190,7 @@ export class CommandCenter {
throw
new
Error
(
'
no_directory
'
);
}
const
clonePromise
=
this
.
model
.
git
.
clone
(
url
,
parentPath
);
const
clonePromise
=
this
.
git
.
clone
(
url
,
parentPath
);
window
.
setStatusBarMessage
(
localize
(
'
cloning
'
,
"
Cloning git repository...
"
),
clonePromise
);
let
repositoryPath
:
string
;
...
...
@@ -226,8 +215,24 @@ export class CommandCenter {
return
openFolder
;
}
@
command
(
'
git.clone
'
)
async
clone
():
Promise
<
void
>
{
/**
* Attempts to clone a git repository. Throws descriptive errors
* for usual error cases. Returns whether the user chose to open
* the resulting folder or otherwise.
*
* This only exists for the walkthrough contribution to have good
* telemetry.
*
* TODO@Christof: when all the telemetry questions are answered,
* please clean this up into a single clone method.
*/
@
command
(
'
git.clone
'
,
true
)
async
clone
():
Promise
<
boolean
>
{
return
await
this
.
_clone
();
}
@
command
(
'
git.cloneSilent
'
,
true
)
async
cloneSilent
():
Promise
<
void
>
{
try
{
await
this
.
_clone
();
}
catch
(
err
)
{
...
...
@@ -710,9 +715,9 @@ export class CommandCenter {
this
.
outputChannel
.
show
();
}
private
createCommand
(
id
:
string
,
key
:
string
,
method
:
Function
):
(...
args
:
any
[])
=>
any
{
private
createCommand
(
id
:
string
,
key
:
string
,
method
:
Function
,
skipModelCheck
:
boolean
):
(...
args
:
any
[])
=>
any
{
const
result
=
(...
args
)
=>
{
if
(
!
this
.
model
)
{
if
(
!
skipModelCheck
&&
!
this
.
model
)
{
window
.
showInformationMessage
(
localize
(
'
disabled
'
,
"
Git is either disabled or not supported in this workspace
"
));
return
;
}
...
...
extensions/git/src/main.ts
浏览文件 @
afdaf562
...
...
@@ -32,22 +32,23 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
const
enabled
=
config
.
get
<
boolean
>
(
'
enabled
'
)
===
true
;
const
workspaceRootPath
=
workspace
.
rootPath
;
const
pathHint
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
string
>
(
'
path
'
);
const
info
=
await
findGit
(
pathHint
);
const
git
=
new
Git
({
gitPath
:
info
.
path
,
version
:
info
.
version
});
if
(
!
workspaceRootPath
||
!
enabled
)
{
const
commandCenter
=
new
CommandCenter
(
undefined
,
outputChannel
,
telemetryReporter
);
const
commandCenter
=
new
CommandCenter
(
git
,
undefined
,
outputChannel
,
telemetryReporter
);
disposables
.
push
(
commandCenter
);
return
;
}
const
pathHint
=
workspace
.
getConfiguration
(
'
git
'
).
get
<
string
>
(
'
path
'
);
const
info
=
await
findGit
(
pathHint
);
const
git
=
new
Git
({
gitPath
:
info
.
path
,
version
:
info
.
version
});
const
askpass
=
new
Askpass
();
const
model
=
new
Model
(
git
,
workspaceRootPath
,
askpass
);
outputChannel
.
appendLine
(
localize
(
'
using git
'
,
"
Using git {0} from {1}
"
,
info
.
version
,
info
.
path
));
git
.
onOutput
(
str
=>
outputChannel
.
append
(
str
),
null
,
disposables
);
const
commandCenter
=
new
CommandCenter
(
model
,
outputChannel
,
telemetryReporter
);
const
commandCenter
=
new
CommandCenter
(
git
,
model
,
outputChannel
,
telemetryReporter
);
const
provider
=
new
GitSCMProvider
(
model
,
commandCenter
);
const
contentProvider
=
new
GitContentProvider
(
model
);
const
checkoutStatusBar
=
new
CheckoutStatusBar
(
model
);
...
...
@@ -79,10 +80,6 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
}
export
function
activate
(
context
:
ExtensionContext
):
any
{
if
(
!
workspace
.
rootPath
)
{
return
;
}
const
disposables
:
Disposable
[]
=
[];
context
.
subscriptions
.
push
(
new
Disposable
(()
=>
Disposable
.
from
(...
disposables
).
dispose
()));
...
...
extensions/git/src/model.ts
浏览文件 @
afdaf562
...
...
@@ -285,10 +285,6 @@ export class Model implements Disposable {
return
anyEvent
(
this
.
onRunOperation
as
Event
<
any
>
,
this
.
onDidRunOperation
as
Event
<
any
>
);
}
get
git
():
Git
{
return
this
.
_git
;
}
private
_mergeGroup
=
new
MergeGroup
([]);
get
mergeGroup
():
MergeGroup
{
return
this
.
_mergeGroup
;
}
...
...
@@ -392,7 +388,7 @@ export class Model implements Disposable {
return
;
}
await
this
.
git
.
init
(
this
.
workspaceRootPath
);
await
this
.
_
git
.
init
(
this
.
workspaceRootPath
);
await
this
.
status
();
}
...
...
@@ -579,9 +575,9 @@ export class Model implements Disposable {
this
.
repositoryDisposable
.
dispose
();
const
disposables
:
Disposable
[]
=
[];
const
repositoryRoot
=
await
this
.
git
.
getRepositoryRoot
(
this
.
workspaceRootPath
);
const
repositoryRoot
=
await
this
.
_
git
.
getRepositoryRoot
(
this
.
workspaceRootPath
);
const
askpassEnv
=
await
this
.
askpass
.
getEnv
();
this
.
repository
=
this
.
git
.
open
(
repositoryRoot
,
askpassEnv
);
this
.
repository
=
this
.
_
git
.
open
(
repositoryRoot
,
askpassEnv
);
const
dotGitPath
=
path
.
join
(
repositoryRoot
,
'
.git
'
);
const
{
event
:
onRawGitChange
,
disposable
:
watcher
}
=
watch
(
dotGitPath
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录