Skip to content

Commit

Permalink
Git - Do not show SmartCommit dialog when using "Commit All" (#155486)
Browse files Browse the repository at this point in the history
Do not show SmartCommit dialog when using "Commit All"
  • Loading branch information
lszomoru authored Jul 18, 2022
1 parent 8bada27 commit b321896
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ export class CommandCenter {
private async smartCommit(
repository: Repository,
getCommitMessage: () => Promise<string | undefined>,
opts?: CommitOptions
opts: CommitOptions
): Promise<boolean> {
const config = workspace.getConfiguration('git', Uri.file(repository.root));
let promptToSaveFilesBeforeCommit = config.get<'always' | 'staged' | 'never'>('promptToSaveFilesBeforeCommit');
Expand Down Expand Up @@ -1498,14 +1498,8 @@ export class CommandCenter {
}
}

if (!opts) {
opts = { all: noStagedChanges };
} else if (!opts.all && noStagedChanges && !opts.empty) {
opts = { ...opts, all: true };
}

// no changes, and the user has not configured to commit all in this case
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.empty) {
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit && !opts.empty && !opts.all) {
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;

if (!suggestSmartCommit) {
Expand All @@ -1529,6 +1523,12 @@ export class CommandCenter {
}
}

if (opts.all === undefined) {
opts = { all: noStagedChanges };
} else if (!opts.all && noStagedChanges && !opts.empty) {
opts = { ...opts, all: true };
}

// enable signing of commits if configured
opts.signCommit = enableCommitSigning;

Expand Down Expand Up @@ -1642,7 +1642,7 @@ export class CommandCenter {
return true;
}

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

0 comments on commit b321896

Please sign in to comment.