@@ -1452,7 +1452,7 @@ export class CommandCenter {
1452
1452
private async smartCommit (
1453
1453
repository : Repository ,
1454
1454
getCommitMessage : ( ) => Promise < string | undefined > ,
1455
- opts ? : CommitOptions
1455
+ opts : CommitOptions
1456
1456
) : Promise < boolean > {
1457
1457
const config = workspace . getConfiguration ( 'git' , Uri . file ( repository . root ) ) ;
1458
1458
let promptToSaveFilesBeforeCommit = config . get < 'always' | 'staged' | 'never' > ( 'promptToSaveFilesBeforeCommit' ) ;
@@ -1498,14 +1498,8 @@ export class CommandCenter {
1498
1498
}
1499
1499
}
1500
1500
1501
- if ( ! opts ) {
1502
- opts = { all : noStagedChanges } ;
1503
- } else if ( ! opts . all && noStagedChanges && ! opts . empty ) {
1504
- opts = { ...opts , all : true } ;
1505
- }
1506
-
1507
1501
// 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 ) {
1509
1503
const suggestSmartCommit = config . get < boolean > ( 'suggestSmartCommit' ) === true ;
1510
1504
1511
1505
if ( ! suggestSmartCommit ) {
@@ -1529,6 +1523,12 @@ export class CommandCenter {
1529
1523
}
1530
1524
}
1531
1525
1526
+ if ( opts . all === undefined ) {
1527
+ opts = { all : noStagedChanges } ;
1528
+ } else if ( ! opts . all && noStagedChanges && ! opts . empty ) {
1529
+ opts = { ...opts , all : true } ;
1530
+ }
1531
+
1532
1532
// enable signing of commits if configured
1533
1533
opts . signCommit = enableCommitSigning ;
1534
1534
@@ -1642,7 +1642,7 @@ export class CommandCenter {
1642
1642
return true ;
1643
1643
}
1644
1644
1645
- private async commitWithAnyInput ( repository : Repository , opts ? : CommitOptions ) : Promise < void > {
1645
+ private async commitWithAnyInput ( repository : Repository , opts : CommitOptions ) : Promise < void > {
1646
1646
const message = repository . inputBox . value ;
1647
1647
const root = Uri . file ( repository . root ) ;
1648
1648
const config = workspace . getConfiguration ( 'git' , root ) ;
0 commit comments