Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ba988122
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,发现更多精彩内容 >>
提交
ba988122
编写于
7月 06, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
e4d42b6b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
10 deletion
+13
-10
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+4
-1
extensions/git/src/git.ts
extensions/git/src/git.ts
+3
-3
extensions/git/src/test/git.test.ts
extensions/git/src/test/git.test.ts
+6
-6
未找到文件。
extensions/git/src/commands.ts
浏览文件 @
ba988122
...
...
@@ -1172,16 +1172,19 @@ export class CommandCenter {
const
HEAD
=
repository
.
HEAD
;
if
(
!
HEAD
||
!
HEAD
.
commit
)
{
window
.
showWarningMessage
(
localize
(
'
no more
'
,
"
Can't undo because HEAD doesn't point to any commit.
"
));
return
;
}
const
commit
=
await
repository
.
getCommit
(
'
HEAD
'
);
if
(
commit
.
previousHashes
.
length
>
0
)
{
if
(
commit
.
parents
.
length
>
0
)
{
await
repository
.
reset
(
'
HEAD~
'
);
}
else
{
await
repository
.
deleteRef
(
'
HEAD
'
);
await
this
.
unstageAll
(
repository
);
}
repository
.
inputBox
.
value
=
commit
.
message
;
}
...
...
extensions/git/src/git.ts
浏览文件 @
ba988122
...
...
@@ -501,7 +501,7 @@ export class Git {
export
interface
Commit
{
hash
:
string
;
message
:
string
;
p
reviousHashe
s
:
string
[];
p
arent
s
:
string
[];
}
export
class
GitStatusParser
{
...
...
@@ -638,8 +638,8 @@ export function parseGitCommit(raw: string): Commit | null {
return
null
;
}
const
p
reviousHashe
s
=
match
[
2
]
?
match
[
2
].
split
(
'
'
)
:
[];
return
{
hash
:
match
[
1
],
message
:
match
[
3
],
p
reviousHashe
s
};
const
p
arent
s
=
match
[
2
]
?
match
[
2
].
split
(
'
'
)
:
[];
return
{
hash
:
match
[
1
],
message
:
match
[
3
],
p
arent
s
};
}
export
interface
DiffOptions
{
...
...
extensions/git/src/test/git.test.ts
浏览文件 @
ba988122
...
...
@@ -177,7 +177,7 @@ suite('git', () => {
});
suite
(
'
parseGitCommit
'
,
()
=>
{
test
(
'
single p
revious
commit
'
,
()
=>
{
test
(
'
single p
arent
commit
'
,
()
=>
{
const
GIT_OUTPUT_SINGLE_PARENT
=
`52c293a05038d865604c2284aa8698bd087915a1
8e5a374372b8393906c7e380dbb09349c5385554
This is a commit message.`
;
...
...
@@ -185,11 +185,11 @@ This is a commit message.`;
assert
.
deepEqual
(
parseGitCommit
(
GIT_OUTPUT_SINGLE_PARENT
),
{
hash
:
'
52c293a05038d865604c2284aa8698bd087915a1
'
,
message
:
'
This is a commit message.
'
,
p
reviousHashe
s
:
[
'
8e5a374372b8393906c7e380dbb09349c5385554
'
]
p
arent
s
:
[
'
8e5a374372b8393906c7e380dbb09349c5385554
'
]
});
});
test
(
'
multiple p
revious
commits
'
,
()
=>
{
test
(
'
multiple p
arent
commits
'
,
()
=>
{
const
GIT_OUTPUT_MULTIPLE_PARENTS
=
`52c293a05038d865604c2284aa8698bd087915a1
8e5a374372b8393906c7e380dbb09349c5385554 df27d8c75b129ab9b178b386077da2822101b217
This is a commit message.`
;
...
...
@@ -197,11 +197,11 @@ This is a commit message.`;
assert
.
deepEqual
(
parseGitCommit
(
GIT_OUTPUT_MULTIPLE_PARENTS
),
{
hash
:
'
52c293a05038d865604c2284aa8698bd087915a1
'
,
message
:
'
This is a commit message.
'
,
p
reviousHashe
s
:
[
'
8e5a374372b8393906c7e380dbb09349c5385554
'
,
'
df27d8c75b129ab9b178b386077da2822101b217
'
]
p
arent
s
:
[
'
8e5a374372b8393906c7e380dbb09349c5385554
'
,
'
df27d8c75b129ab9b178b386077da2822101b217
'
]
});
});
test
(
'
no p
revious
commits
'
,
async
()
=>
{
test
(
'
no p
arent
commits
'
,
async
()
=>
{
const
GIT_OUTPUT_NO_PARENTS
=
`52c293a05038d865604c2284aa8698bd087915a1
This is a commit message.`
;
...
...
@@ -209,7 +209,7 @@ This is a commit message.`;
assert
.
deepEqual
(
parseGitCommit
(
GIT_OUTPUT_NO_PARENTS
),
{
hash
:
'
52c293a05038d865604c2284aa8698bd087915a1
'
,
message
:
'
This is a commit message.
'
,
p
reviousHashe
s
:
[]
p
arent
s
:
[]
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录