Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f4f00621
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,发现更多精彩内容 >>
提交
f4f00621
编写于
11月 21, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
git input box shouldn't handle comments
related to #84201
上级
3b0571d8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
36 deletion
+8
-36
extensions/git/package.json
extensions/git/package.json
+0
-6
extensions/git/package.nls.json
extensions/git/package.nls.json
+0
-1
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+2
-1
extensions/git/src/git.ts
extensions/git/src/git.ts
+5
-15
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+1
-13
未找到文件。
extensions/git/package.json
浏览文件 @
f4f00621
...
...
@@ -1608,12 +1608,6 @@
"default"
:
"mixed"
,
"description"
:
"%config.untrackedChanges%"
,
"scope"
:
"resource"
},
"git.restoreCommitTemplateComments"
:
{
"type"
:
"boolean"
,
"scope"
:
"resource"
,
"default"
:
true
,
"description"
:
"%config.restoreCommitTemplateComments%"
}
}
},
...
...
extensions/git/package.nls.json
浏览文件 @
f4f00621
...
...
@@ -139,7 +139,6 @@
"config.untrackedChanges.mixed"
:
"All changes, tracked and untracked, appear together and behave equally."
,
"config.untrackedChanges.separate"
:
"Untracked changes appear separately in the Source Control view. They are also excluded from several actions."
,
"config.untrackedChanges.hidden"
:
"Untracked changes are hidden and excluded from several actions."
,
"config.restoreCommitTemplateComments"
:
"Controls whether to restore commit template comments in the commit input box."
,
"colors.added"
:
"Color for added resources."
,
"colors.modified"
:
"Color for modified resources."
,
"colors.deleted"
:
"Color for deleted resources."
,
...
...
extensions/git/src/commands.ts
浏览文件 @
f4f00621
...
...
@@ -1406,6 +1406,7 @@ export class CommandCenter {
const
message
=
repository
.
inputBox
.
value
;
const
getCommitMessage
=
async
()
=>
{
let
_message
:
string
|
undefined
=
message
;
if
(
!
_message
)
{
let
value
:
string
|
undefined
=
undefined
;
...
...
@@ -1430,7 +1431,7 @@ export class CommandCenter {
});
}
return
_message
?
repository
.
cleanUpCommitEditMessage
(
_message
)
:
_message
;
return
_message
;
};
const
didCommit
=
await
this
.
smartCommit
(
repository
,
getCommitMessage
,
opts
);
...
...
extensions/git/src/git.ts
浏览文件 @
f4f00621
...
...
@@ -1810,18 +1810,9 @@ export class Repository {
}
}
cleanupCommitEditMessage
(
message
:
string
):
string
{
// If the message is a single line starting with whitespace followed by `#`, just allow it.
if
(
/^
\s
*#
[^\n]
*$/
.
test
(
message
))
{
return
message
;
}
// Else, remove all lines starting with whitespace followed by `#`.
// TODO: Support core.commentChar
return
message
.
replace
(
/^
(\s
*#
)(
.*
)
$
(\n?)
/gm
,
(
_
,
prefix
,
content
,
suffix
)
=>
{
// https://github.com/microsoft/vscode/issues/84201#issuecomment-552834814
return
/^
\d
/
.
test
(
content
)
?
`
${
prefix
}${
content
}${
suffix
}
`
:
''
;
}).
trim
();
// TODO: Support core.commentChar
stripCommitMessageComments
(
message
:
string
):
string
{
return
message
.
replace
(
/^
\s
*#.*$
\n?
/gm
,
''
).
trim
();
}
async
getMergeMessage
():
Promise
<
string
|
undefined
>
{
...
...
@@ -1829,7 +1820,7 @@ export class Repository {
try
{
const
raw
=
await
fs
.
readFile
(
mergeMsgPath
,
'
utf8
'
);
return
raw
.
trim
(
);
return
this
.
stripCommitMessageComments
(
raw
);
}
catch
{
return
undefined
;
}
...
...
@@ -1853,8 +1844,7 @@ export class Repository {
}
const
raw
=
await
fs
.
readFile
(
templatePath
,
'
utf8
'
);
return
raw
.
trim
();
return
this
.
stripCommitMessageComments
(
raw
);
}
catch
(
err
)
{
return
''
;
}
...
...
extensions/git/src/repository.ts
浏览文件 @
f4f00621
...
...
@@ -844,15 +844,7 @@ export class Repository implements Disposable {
return
mergeMessage
;
}
let
template
=
await
this
.
repository
.
getCommitTemplate
();
const
config
=
workspace
.
getConfiguration
(
'
git
'
,
Uri
.
file
(
this
.
root
));
if
(
!
config
.
get
<
boolean
>
(
'
restoreCommitTemplateComments
'
))
{
template
=
this
.
cleanUpCommitEditMessage
(
template
);
}
return
template
;
return
await
this
.
repository
.
getCommitTemplate
();
}
getConfigs
():
Promise
<
{
key
:
string
;
value
:
string
;
}[]
>
{
...
...
@@ -1286,10 +1278,6 @@ export class Repository implements Disposable {
return
await
this
.
run
(
Operation
.
GetCommitTemplate
,
async
()
=>
this
.
repository
.
getCommitTemplate
());
}
cleanUpCommitEditMessage
(
editMessage
:
string
):
string
{
return
this
.
repository
.
cleanupCommitEditMessage
(
editMessage
);
}
async
ignore
(
files
:
Uri
[]):
Promise
<
void
>
{
return
await
this
.
run
(
Operation
.
Ignore
,
async
()
=>
{
const
ignoreFile
=
`
${
this
.
repository
.
root
}${
path
.
sep
}
.gitignore`
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录