Skip to content

Commit b321896

Browse files
authored
Git - Do not show SmartCommit dialog when using "Commit All" (microsoft#155486)
Do not show SmartCommit dialog when using "Commit All"
1 parent 8bada27 commit b321896

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extensions/git/src/commands.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ export class CommandCenter {
14521452
private async smartCommit(
14531453
repository: Repository,
14541454
getCommitMessage: () => Promise<string | undefined>,
1455-
opts?: CommitOptions
1455+
opts: CommitOptions
14561456
): Promise<boolean> {
14571457
const config = workspace.getConfiguration('git', Uri.file(repository.root));
14581458
let promptToSaveFilesBeforeCommit = config.get<'always' | 'staged' | 'never'>('promptToSaveFilesBeforeCommit');
@@ -1498,14 +1498,8 @@ export class CommandCenter {
14981498
}
14991499
}
15001500

1501-
if (!opts) {
1502-
opts = { all: noStagedChanges };
1503-
} else if (!opts.all && noStagedChanges && !opts.empty) {
1504-
opts = { ...opts, all: true };
1505-
}
1506-
15071501
// no changes, and the user has not configured to commit all in this case
1508-
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.empty) {
1502+
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.empty && !opts.all) {
15091503
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;
15101504

15111505
if (!suggestSmartCommit) {
@@ -1529,6 +1523,12 @@ export class CommandCenter {
15291523
}
15301524
}
15311525

1526+
if (opts.all === undefined) {
1527+
opts = { all: noStagedChanges };
1528+
} else if (!opts.all && noStagedChanges && !opts.empty) {
1529+
opts = { ...opts, all: true };
1530+
}
1531+
15321532
// enable signing of commits if configured
15331533
opts.signCommit = enableCommitSigning;
15341534

@@ -1642,7 +1642,7 @@ export class CommandCenter {
16421642
return true;
16431643
}
16441644

1645-
private async commitWithAnyInput(repository: Repository, opts?: CommitOptions): Promise<void> {
1645+
private async commitWithAnyInput(repository: Repository, opts: CommitOptions): Promise<void> {
16461646
const message = repository.inputBox.value;
16471647
const root = Uri.file(repository.root);
16481648
const config = workspace.getConfiguration('git', root);

0 commit comments

Comments
 (0)