Skip to content

Commit a8231df

Browse files
committed
1 parent 46233c3 commit a8231df

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

extensions/git/src/commands.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,9 @@ export class CommandCenter {
13231323
}
13241324

13251325
const enableSmartCommit = config.get<boolean>('enableSmartCommit') === true;
1326+
const enableCommitSigning = config.get<boolean>('enableCommitSigning') === true;
1327+
const noStagedChanges = repository.indexGroup.resourceStates.length === 0;
1328+
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0;
13261329

13271330
if (promptToSaveFilesBeforeCommit !== 'never') {
13281331
let documents = workspace.textDocuments
@@ -1343,17 +1346,13 @@ export class CommandCenter {
13431346

13441347
if (pick === saveAndCommit) {
13451348
await Promise.all(documents.map(d => d.save()));
1346-
await repository.add([]);
1349+
await repository.add(documents.map(d => d.uri));
13471350
} else if (pick !== commit) {
13481351
return false; // do not commit on cancel
13491352
}
13501353
}
13511354
}
13521355

1353-
const enableCommitSigning = config.get<boolean>('enableCommitSigning') === true;
1354-
const noStagedChanges = repository.indexGroup.resourceStates.length === 0;
1355-
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0;
1356-
13571356
// no changes, and the user has not configured to commit all in this case
13581357
if (!noUnstagedChanges && noStagedChanges && !enableSmartCommit) {
13591358
const suggestSmartCommit = config.get<boolean>('suggestSmartCommit') === true;

0 commit comments

Comments
 (0)