mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-15 16:34:50 +01:00
Merge branch 'pr/70539'
This commit is contained in:
@@ -1148,6 +1148,20 @@
|
||||
"description": "%config.enableSmartCommit%",
|
||||
"default": false
|
||||
},
|
||||
"git.smartCommitChanges": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"all",
|
||||
"tracked"
|
||||
],
|
||||
"enumDescriptions": [
|
||||
"%config.smartCommitChanges.all%",
|
||||
"%config.smartCommitChanges.tracked%"
|
||||
],
|
||||
"scope": "resource",
|
||||
"description": "%config.smartCommitChanges%",
|
||||
"default": "all"
|
||||
},
|
||||
"git.suggestSmartCommit": {
|
||||
"type": "boolean",
|
||||
"scope": "resource",
|
||||
|
||||
@@ -89,6 +89,9 @@
|
||||
"config.ignoreLimitWarning": "Ignores the warning when there are too many changes in a repository.",
|
||||
"config.defaultCloneDirectory": "The default location to clone a git repository.",
|
||||
"config.enableSmartCommit": "Commit all changes when there are no staged changes.",
|
||||
"config.smartCommitChanges": "Control which changes are automatically staged by Smart Commit.",
|
||||
"config.smartCommitChanges.all": "Automatically stage all changes.",
|
||||
"config.smartCommitChanges.tracked": "Automatically staged tracked changes only.",
|
||||
"config.suggestSmartCommit": "Suggests to enable smart commit (commit all changes when there are no staged changes).",
|
||||
"config.enableCommitSigning": "Enables commit signing with GPG.",
|
||||
"config.discardAllScope": "Controls what changes are discarded by the `Discard all changes` command. `all` discards all changes. `tracked` discards only tracked files. `prompt` shows a prompt dialog every time the action is run.",
|
||||
|
||||
@@ -1275,8 +1275,8 @@ export class CommandCenter {
|
||||
|
||||
// no changes, and the user has not configured to commit all in this case
|
||||
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit) {
|
||||
|
||||
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
|
||||
|
||||
if (!suggestSmartCommit) {
|
||||
return false;
|
||||
}
|
||||
@@ -1330,6 +1330,10 @@ export class CommandCenter {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opts.all && config.get<'all' | 'tracked'>('smartCommitChanges') === 'tracked') {
|
||||
opts.all = 'tracked';
|
||||
}
|
||||
|
||||
await repository.commit(message, opts);
|
||||
|
||||
const postCommitCommand = config.get<'none' | 'push' | 'sync'>('postCommitCommand');
|
||||
|
||||
@@ -642,7 +642,7 @@ export function parseLsFiles(raw: string): LsFilesElement[] {
|
||||
}
|
||||
|
||||
export interface CommitOptions {
|
||||
all?: boolean;
|
||||
all?: boolean | 'tracked';
|
||||
amend?: boolean;
|
||||
signoff?: boolean;
|
||||
signCommit?: boolean;
|
||||
@@ -1081,8 +1081,16 @@ export class Repository {
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
async add(paths: string[]): Promise<void> {
|
||||
const args = ['add', '-A', '--'];
|
||||
async add(paths: string[], opts?: { update?: boolean }): Promise<void> {
|
||||
const args = ['add'];
|
||||
|
||||
if (opts && opts.update) {
|
||||
args.push('-u');
|
||||
} else {
|
||||
args.push('-A');
|
||||
}
|
||||
|
||||
args.push('--');
|
||||
|
||||
if (paths && paths.length) {
|
||||
args.push.apply(args, paths);
|
||||
|
||||
@@ -910,7 +910,8 @@ export class Repository implements Disposable {
|
||||
if (this.rebaseCommit) {
|
||||
await this.run(Operation.RebaseContinue, async () => {
|
||||
if (opts.all) {
|
||||
await this.repository.add([]);
|
||||
const addOpts = opts.all === 'tracked' ? { update: true } : {};
|
||||
await this.repository.add([], addOpts);
|
||||
}
|
||||
|
||||
await this.repository.rebaseContinue();
|
||||
@@ -918,9 +919,11 @@ export class Repository implements Disposable {
|
||||
} else {
|
||||
await this.run(Operation.Commit, async () => {
|
||||
if (opts.all) {
|
||||
await this.repository.add([]);
|
||||
const addOpts = opts.all === 'tracked' ? { update: true } : {};
|
||||
await this.repository.add([], addOpts);
|
||||
}
|
||||
|
||||
delete opts.all;
|
||||
await this.repository.commit(message, opts);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user