mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
parent
2ae81ab6ec
commit
d266d9a994
|
@ -44,5 +44,6 @@
|
|||
"config.ignoreLegacyWarning": "Ignores the legacy Git warning",
|
||||
"config.ignoreLimitWarning": "Ignores the warning when there are too many changes in a repository",
|
||||
"config.defaultCloneDirectory": "The default location where to clone a git repository",
|
||||
"config.enableSmartCommit": "Commit all changes when there are no staged changes."
|
||||
"config.enableSmartCommit": "Commit all changes when there are no staged changes.",
|
||||
"config.enableCommitSigning": "Enables commit signing with GPG."
|
||||
}
|
|
@ -600,6 +600,7 @@ export class CommandCenter {
|
|||
): Promise<boolean> {
|
||||
const config = workspace.getConfiguration('git');
|
||||
const enableSmartCommit = config.get<boolean>('enableSmartCommit') === true;
|
||||
const enableCommitSigning = config.get<boolean>('enableCommitSigning') === true;
|
||||
const noStagedChanges = this.model.indexGroup.resources.length === 0;
|
||||
const noUnstagedChanges = this.model.workingTreeGroup.resources.length === 0;
|
||||
|
||||
|
@ -623,6 +624,9 @@ export class CommandCenter {
|
|||
opts = { all: noStagedChanges };
|
||||
}
|
||||
|
||||
// enable signing of commits if configurated
|
||||
opts.signCommit = enableCommitSigning;
|
||||
|
||||
if (
|
||||
// no changes
|
||||
(noStagedChanges && noUnstagedChanges)
|
||||
|
|
|
@ -612,7 +612,7 @@ export class Repository {
|
|||
}
|
||||
}
|
||||
|
||||
async commit(message: string, opts: { all?: boolean, amend?: boolean, signoff?: boolean } = Object.create(null)): Promise<void> {
|
||||
async commit(message: string, opts: { all?: boolean, amend?: boolean, signoff?: boolean, signCommit?: boolean} = Object.create(null)): Promise<void> {
|
||||
const args = ['commit', '--quiet', '--allow-empty-message', '--file', '-'];
|
||||
|
||||
if (opts.all) {
|
||||
|
@ -627,6 +627,10 @@ export class Repository {
|
|||
args.push('--signoff');
|
||||
}
|
||||
|
||||
if (opts.signCommit) {
|
||||
args.push('-S');
|
||||
}
|
||||
|
||||
try {
|
||||
await this.run(args, { input: message || '' });
|
||||
} catch (commitErr) {
|
||||
|
|
|
@ -290,6 +290,7 @@ export interface CommitOptions {
|
|||
all?: boolean;
|
||||
amend?: boolean;
|
||||
signoff?: boolean;
|
||||
signCommit?: boolean;
|
||||
}
|
||||
|
||||
export class Model implements Disposable {
|
||||
|
|
Loading…
Reference in a new issue