Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7ad40c09
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
7ad40c09
编写于
4月 21, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipc: git askpass service
上级
1e0204a2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
18 deletion
+41
-18
src/vs/workbench/electron-main/main.ts
src/vs/workbench/electron-main/main.ts
+5
-1
src/vs/workbench/parts/git/common/git.ts
src/vs/workbench/parts/git/common/git.ts
+5
-2
src/vs/workbench/parts/git/common/gitIpc.ts
src/vs/workbench/parts/git/common/gitIpc.ts
+26
-1
src/vs/workbench/parts/git/electron-main/askpassService.ts
src/vs/workbench/parts/git/electron-main/askpassService.ts
+2
-1
src/vs/workbench/parts/git/node/askpass.ts
src/vs/workbench/parts/git/node/askpass.ts
+3
-13
未找到文件。
src/vs/workbench/electron-main/main.ts
浏览文件 @
7ad40c09
...
...
@@ -20,6 +20,7 @@ import {Instance as UpdateManager} from 'vs/workbench/electron-main/update-manag
import
{
Server
,
serve
,
connect
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
getUserEnvironment
}
from
'
vs/base/node/env
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
AskpassChannel
}
from
'
vs/workbench/parts/git/common/gitIpc
'
;
import
{
GitAskpassService
}
from
'
vs/workbench/parts/git/electron-main/askpassService
'
;
import
{
spawnSharedProcess
}
from
'
vs/workbench/electron-main/sharedProcess
'
;
import
{
Mutex
}
from
'
windows-mutex
'
;
...
...
@@ -119,7 +120,10 @@ function main(ipcServer: Server, userEnv: env.IProcessEnvironment): void {
// Register IPC services
ipcServer
.
registerService
(
'
LaunchService
'
,
new
LaunchService
());
ipcServer
.
registerService
(
'
GitAskpassService
'
,
new
GitAskpassService
());
const
askpassService
=
new
GitAskpassService
();
const
askpassChannel
=
new
AskpassChannel
(
askpassService
);
ipcServer
.
registerChannel
(
'
askpass
'
,
askpassChannel
);
// Used by sub processes to communicate back to the main instance
process
.
env
[
'
VSCODE_PID
'
]
=
''
+
process
.
pid
;
...
...
src/vs/workbench/parts/git/common/git.ts
浏览文件 @
7ad40c09
...
...
@@ -243,10 +243,9 @@ export interface IGitCredentialScope {
path
:
string
;
}
export
interface
I
Git
Credentials
{
export
interface
ICredentials
{
username
:
string
;
password
:
string
;
store
:
boolean
;
}
export
interface
IGitServiceError
extends
Error
{
...
...
@@ -316,6 +315,10 @@ export interface IGitService extends EventEmitter.IEventEmitter {
onOutput
():
WinJS
.
Promise
;
}
export
interface
IAskpassService
{
askpass
(
id
:
string
,
host
:
string
,
command
:
string
):
WinJS
.
TPromise
<
ICredentials
>
;
}
// Utils
export
function
isValidBranchName
(
value
:
string
):
boolean
{
...
...
src/vs/workbench/parts/git/common/gitIpc.ts
浏览文件 @
7ad40c09
...
...
@@ -7,7 +7,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IPushOptions
}
from
'
./git
'
;
import
{
IRawGitService
,
RawServiceState
,
IRawStatus
,
IPushOptions
,
IAskpassService
,
ICredentials
}
from
'
./git
'
;
export
interface
IGitChannel
extends
IChannel
{
call
(
command
:
'
getVersion
'
):
TPromise
<
string
>
;
...
...
@@ -157,4 +157,29 @@ export class GitChannelClient implements IRawGitService {
onOutput
():
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
onOutput
'
);
}
}
export
interface
IAskpassChannel
extends
IChannel
{
call
(
command
:
'
askpass
'
,
id
:
string
,
host
:
string
,
gitCommand
:
string
):
TPromise
<
ICredentials
>
;
call
(
command
:
string
,
...
args
:
any
[]):
TPromise
<
any
>
;
}
export
class
AskpassChannel
implements
IAskpassChannel
{
constructor
(
private
service
:
IAskpassService
)
{
}
call
(
command
:
string
,
...
args
:
any
[]):
TPromise
<
any
>
{
switch
(
command
)
{
case
'
askpass
'
:
return
this
.
service
.
askpass
(
args
[
0
],
args
[
1
],
args
[
2
]);
}
}
}
export
class
AskpassChannelClient
implements
IAskpassService
{
constructor
(
private
channel
:
IAskpassChannel
)
{
}
askpass
(
id
:
string
,
host
:
string
,
command
:
string
):
TPromise
<
ICredentials
>
{
return
this
.
channel
.
call
(
'
askpass
'
,
id
,
host
,
command
);
}
}
\ No newline at end of file
src/vs/workbench/parts/git/electron-main/askpassService.ts
浏览文件 @
7ad40c09
...
...
@@ -7,6 +7,7 @@ import * as nls from 'vs/nls';
import
{
ipcMain
as
ipc
,
BrowserWindow
}
from
'
electron
'
;
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IAskpassService
}
from
'
vs/workbench/parts/git/common/git
'
;
export
interface
ICredentials
{
username
:
string
;
...
...
@@ -23,7 +24,7 @@ interface IContext {
window
:
Electron
.
BrowserWindow
;
}
export
class
GitAskpassService
{
export
class
GitAskpassService
implements
IAskpassService
{
private
askpassCache
:
{
[
id
:
string
]:
IContext
}
=
Object
.
create
(
null
);
...
...
src/vs/workbench/parts/git/node/askpass.ts
浏览文件 @
7ad40c09
...
...
@@ -6,20 +6,9 @@
'
use strict
'
;
import
{
connect
}
from
'
vs/base/parts/ipc/node/ipc.net
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IAskpassChannel
,
AskpassChannelClient
}
from
'
vs/workbench/parts/git/common/gitIpc
'
;
import
*
as
fs
from
'
fs
'
;
export
interface
ICredentials
{
username
:
string
;
password
:
string
;
}
export
class
GitAskpassServiceStub
{
public
askpass
(
id
:
string
,
host
:
string
,
command
:
string
):
TPromise
<
ICredentials
>
{
throw
new
Error
(
'
not implemented
'
);
}
}
function
fatal
(
err
:
any
):
void
{
console
.
error
(
err
);
process
.
exit
(
1
);
...
...
@@ -49,7 +38,8 @@ function main(argv: string[]): void {
connect
(
process
.
env
[
'
VSCODE_IPC_HOOK
'
])
.
then
(
client
=>
{
const
service
=
client
.
getChannel
<
GitAskpassServiceStub
>
(
'
GitAskpassService
'
,
GitAskpassServiceStub
);
const
channel
=
client
.
getChannel
<
IAskpassChannel
>
(
'
askpass
'
);
const
service
=
new
AskpassChannelClient
(
channel
);
return
service
.
askpass
(
id
,
host
,
process
.
env
[
'
MONACO_GIT_COMMAND
'
]).
then
(
result
=>
{
if
(
result
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录