Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9b0eee12
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,发现更多精彩内容 >>
提交
9b0eee12
编写于
9月 12, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
commit empty
上级
e2b2b5bc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
34 deletion
+43
-34
extensions/git/package.json
extensions/git/package.json
+3
-12
extensions/git/package.nls.json
extensions/git/package.nls.json
+1
-0
extensions/git/src/commands.ts
extensions/git/src/commands.ts
+29
-12
extensions/git/src/git.ts
extensions/git/src/git.ts
+9
-1
extensions/git/src/repository.ts
extensions/git/src/repository.ts
+1
-9
未找到文件。
extensions/git/package.json
浏览文件 @
9b0eee12
...
@@ -422,10 +422,6 @@
...
@@ -422,10 +422,6 @@
"command"
:
"git.commit"
,
"command"
:
"git.commit"
,
"when"
:
"config.git.enabled && gitOpenRepositoryCount != 0"
"when"
:
"config.git.enabled && gitOpenRepositoryCount != 0"
},
},
{
"command"
:
"git.commitEmpty"
,
"when"
:
"config.git.allowcommitEmptys && gitOpenRepositoryCount != 0"
},
{
{
"command"
:
"git.commitStaged"
,
"command"
:
"git.commitStaged"
,
"when"
:
"config.git.enabled && gitOpenRepositoryCount != 0"
"when"
:
"config.git.enabled && gitOpenRepositoryCount != 0"
...
@@ -608,11 +604,6 @@
...
@@ -608,11 +604,6 @@
"group"
:
"3_commit"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git"
"when"
:
"scmProvider == git"
},
},
{
"command"
:
"git.commitEmpty"
,
"group"
:
"3_commit"
,
"when"
:
"scmProvider == git"
},
{
{
"command"
:
"git.commitStagedSigned"
,
"command"
:
"git.commitStagedSigned"
,
"group"
:
"3_commit"
,
"group"
:
"3_commit"
,
...
@@ -1005,11 +996,11 @@
...
@@ -1005,11 +996,11 @@
"description"
:
"%config.enableCommitSigning%"
,
"description"
:
"%config.enableCommitSigning%"
,
"default"
:
false
"default"
:
false
},
},
"git.
allow
EmptyCommits"
:
{
"git.
confirm
EmptyCommits"
:
{
"type"
:
"boolean"
,
"type"
:
"boolean"
,
"scope"
:
"resource"
,
"scope"
:
"resource"
,
"description"
:
"%config.
allow
EmptyCommits%"
,
"description"
:
"%config.
confirm
EmptyCommits%"
,
"default"
:
fals
e
"default"
:
tru
e
},
},
"git.decorations.enabled"
:
{
"git.decorations.enabled"
:
{
"type"
:
"boolean"
,
"type"
:
"boolean"
,
...
...
extensions/git/package.nls.json
浏览文件 @
9b0eee12
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
"config.ignoredRepositories"
:
"List of git repositories to ignore."
,
"config.ignoredRepositories"
:
"List of git repositories to ignore."
,
"config.showProgress"
:
"Controls whether git actions should show progress."
,
"config.showProgress"
:
"Controls whether git actions should show progress."
,
"config.rebaseWhenSync"
:
"Use rebase instead of merge when running the sync command."
,
"config.rebaseWhenSync"
:
"Use rebase instead of merge when running the sync command."
,
"config.confirmEmptyCommits"
:
"Always confirm the creation of empty commits."
,
"colors.modified"
:
"Color for modified resources."
,
"colors.modified"
:
"Color for modified resources."
,
"colors.deleted"
:
"Color for deleted resources."
,
"colors.deleted"
:
"Color for deleted resources."
,
"colors.untracked"
:
"Color for untracked resources."
,
"colors.untracked"
:
"Color for untracked resources."
,
...
...
extensions/git/src/commands.ts
浏览文件 @
9b0eee12
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
'
use strict
'
;
'
use strict
'
;
import
{
Uri
,
commands
,
Disposable
,
window
,
workspace
,
QuickPickItem
,
OutputChannel
,
Range
,
WorkspaceEdit
,
Position
,
LineChange
,
SourceControlResourceState
,
TextDocumentShowOptions
,
ViewColumn
,
ProgressLocation
,
TextEditor
,
MessageOptions
}
from
'
vscode
'
;
import
{
Uri
,
commands
,
Disposable
,
window
,
workspace
,
QuickPickItem
,
OutputChannel
,
Range
,
WorkspaceEdit
,
Position
,
LineChange
,
SourceControlResourceState
,
TextDocumentShowOptions
,
ViewColumn
,
ProgressLocation
,
TextEditor
,
MessageOptions
}
from
'
vscode
'
;
import
{
Git
}
from
'
./git
'
;
import
{
Git
,
CommitOptions
}
from
'
./git
'
;
import
{
Repository
,
Resource
,
Status
,
CommitOptions
,
ResourceGroupType
}
from
'
./repository
'
;
import
{
Repository
,
Resource
,
Status
,
ResourceGroupType
}
from
'
./repository
'
;
import
{
Model
}
from
'
./model
'
;
import
{
Model
}
from
'
./model
'
;
import
{
toGitUri
,
fromGitUri
}
from
'
./uri
'
;
import
{
toGitUri
,
fromGitUri
}
from
'
./uri
'
;
import
{
grep
,
isDescendant
,
pathEquals
}
from
'
./util
'
;
import
{
grep
,
isDescendant
,
pathEquals
}
from
'
./util
'
;
...
@@ -1087,11 +1087,11 @@ export class CommandCenter {
...
@@ -1087,11 +1087,11 @@ export class CommandCenter {
if
(
if
(
(
(
// no changes
// no changes
(
noStagedChanges
&&
noUnstagedChanges
)
(
noStagedChanges
&&
noUnstagedChanges
)
// or no staged changes and not `all`
// or no staged changes and not `all`
||
(
!
opts
.
all
&&
noStagedChanges
)
||
(
!
opts
.
all
&&
noStagedChanges
)
)
)
&&
!
opts
.
empty
&&
!
opts
.
empty
)
{
)
{
window
.
showInformationMessage
(
localize
(
'
no changes
'
,
"
There are no changes to commit.
"
));
window
.
showInformationMessage
(
localize
(
'
no changes
'
,
"
There are no changes to commit.
"
));
...
@@ -1137,11 +1137,6 @@ export class CommandCenter {
...
@@ -1137,11 +1137,6 @@ export class CommandCenter {
}
}
}
}
@
command
(
'
git.commitEmpty
'
,
{
repository
:
true
})
async
commit
(
repository
:
Repository
):
Promise
<
void
>
{
await
this
.
commitWithAnyInput
(
repository
,
{
empty
:
true
});
}
@
command
(
'
git.commit
'
,
{
repository
:
true
})
@
command
(
'
git.commit
'
,
{
repository
:
true
})
async
commit
(
repository
:
Repository
):
Promise
<
void
>
{
async
commit
(
repository
:
Repository
):
Promise
<
void
>
{
await
this
.
commitWithAnyInput
(
repository
);
await
this
.
commitWithAnyInput
(
repository
);
...
@@ -1190,6 +1185,28 @@ export class CommandCenter {
...
@@ -1190,6 +1185,28 @@ export class CommandCenter {
await
this
.
commitWithAnyInput
(
repository
,
{
all
:
true
,
amend
:
true
});
await
this
.
commitWithAnyInput
(
repository
,
{
all
:
true
,
amend
:
true
});
}
}
@
command
(
'
git.commitEmpty
'
,
{
repository
:
true
})
async
commitEmpty
(
repository
:
Repository
):
Promise
<
void
>
{
const
root
=
Uri
.
file
(
repository
.
root
);
const
config
=
workspace
.
getConfiguration
(
'
git
'
,
root
);
const
shouldPrompt
=
config
.
get
<
boolean
>
(
'
confirmEmptyCommits
'
)
===
true
;
if
(
shouldPrompt
)
{
const
message
=
localize
(
'
confirm emtpy commit
'
,
"
Are you sure you want to create an empty commit?
"
);
const
yes
=
localize
(
'
yes
'
,
"
Yes
"
);
const
neverAgain
=
localize
(
'
yes never again
'
,
"
Yes, Don't Show Again
"
);
const
pick
=
await
window
.
showWarningMessage
(
message
,
{
modal
:
true
},
yes
,
neverAgain
);
if
(
pick
===
neverAgain
)
{
await
config
.
update
(
'
confirmEmptyCommits
'
,
false
,
true
);
}
else
if
(
pick
!==
yes
)
{
return
;
}
}
await
this
.
commitWithAnyInput
(
repository
,
{
empty
:
true
});
}
@
command
(
'
git.undoCommit
'
,
{
repository
:
true
})
@
command
(
'
git.undoCommit
'
,
{
repository
:
true
})
async
undoCommit
(
repository
:
Repository
):
Promise
<
void
>
{
async
undoCommit
(
repository
:
Repository
):
Promise
<
void
>
{
const
HEAD
=
repository
.
HEAD
;
const
HEAD
=
repository
.
HEAD
;
...
...
extensions/git/src/git.ts
浏览文件 @
9b0eee12
...
@@ -623,6 +623,14 @@ export function parseLsFiles(raw: string): LsFilesElement[] {
...
@@ -623,6 +623,14 @@ export function parseLsFiles(raw: string): LsFilesElement[] {
.
map
(([,
mode
,
object
,
stage
,
file
])
=>
({
mode
,
object
,
stage
,
file
}));
.
map
(([,
mode
,
object
,
stage
,
file
])
=>
({
mode
,
object
,
stage
,
file
}));
}
}
export
interface
CommitOptions
{
all
?:
boolean
;
amend
?:
boolean
;
signoff
?:
boolean
;
signCommit
?:
boolean
;
empty
?:
boolean
;
}
export
class
Repository
{
export
class
Repository
{
constructor
(
constructor
(
...
@@ -940,7 +948,7 @@ export class Repository {
...
@@ -940,7 +948,7 @@ export class Repository {
}
}
}
}
async
commit
(
message
:
string
,
opts
:
{
all
?:
boolean
,
amend
?:
boolean
,
signoff
?:
boolean
,
signCommit
?:
boolean
}
=
Object
.
create
(
null
)):
Promise
<
void
>
{
async
commit
(
message
:
string
,
opts
:
CommitOptions
=
Object
.
create
(
null
)):
Promise
<
void
>
{
const
args
=
[
'
commit
'
,
'
--quiet
'
,
'
--allow-empty-message
'
,
'
--file
'
,
'
-
'
];
const
args
=
[
'
commit
'
,
'
--quiet
'
,
'
--allow-empty-message
'
,
'
--file
'
,
'
-
'
];
if
(
opts
.
all
)
{
if
(
opts
.
all
)
{
...
...
extensions/git/src/repository.ts
浏览文件 @
9b0eee12
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
'
use strict
'
;
'
use strict
'
;
import
{
commands
,
Uri
,
Command
,
EventEmitter
,
Event
,
scm
,
SourceControl
,
SourceControlInputBox
,
SourceControlResourceGroup
,
SourceControlResourceState
,
SourceControlResourceDecorations
,
SourceControlInputBoxValidation
,
Disposable
,
ProgressLocation
,
window
,
workspace
,
WorkspaceEdit
,
ThemeColor
,
DecorationData
,
Memento
,
SourceControlInputBoxValidationType
}
from
'
vscode
'
;
import
{
commands
,
Uri
,
Command
,
EventEmitter
,
Event
,
scm
,
SourceControl
,
SourceControlInputBox
,
SourceControlResourceGroup
,
SourceControlResourceState
,
SourceControlResourceDecorations
,
SourceControlInputBoxValidation
,
Disposable
,
ProgressLocation
,
window
,
workspace
,
WorkspaceEdit
,
ThemeColor
,
DecorationData
,
Memento
,
SourceControlInputBoxValidationType
}
from
'
vscode
'
;
import
{
Repository
as
BaseRepository
,
Commit
,
Stash
,
GitError
,
Submodule
}
from
'
./git
'
;
import
{
Repository
as
BaseRepository
,
Commit
,
Stash
,
GitError
,
Submodule
,
CommitOptions
}
from
'
./git
'
;
import
{
anyEvent
,
filterEvent
,
eventToPromise
,
dispose
,
find
,
isDescendant
,
IDisposable
,
onceEvent
,
EmptyDisposable
,
debounceEvent
}
from
'
./util
'
;
import
{
anyEvent
,
filterEvent
,
eventToPromise
,
dispose
,
find
,
isDescendant
,
IDisposable
,
onceEvent
,
EmptyDisposable
,
debounceEvent
}
from
'
./util
'
;
import
{
memoize
,
throttle
,
debounce
}
from
'
./decorators
'
;
import
{
memoize
,
throttle
,
debounce
}
from
'
./decorators
'
;
import
{
toGitUri
}
from
'
./uri
'
;
import
{
toGitUri
}
from
'
./uri
'
;
...
@@ -390,14 +390,6 @@ class OperationsImpl implements Operations {
...
@@ -390,14 +390,6 @@ class OperationsImpl implements Operations {
}
}
}
}
export
interface
CommitOptions
{
all
?:
boolean
;
amend
?:
boolean
;
signoff
?:
boolean
;
signCommit
?:
boolean
;
empty
?:
boolean
;
}
export
interface
GitResourceGroup
extends
SourceControlResourceGroup
{
export
interface
GitResourceGroup
extends
SourceControlResourceGroup
{
resourceStates
:
Resource
[];
resourceStates
:
Resource
[];
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录